Welcome Guest, Not a member yet? Register   Sign In
can't even get thru tutorial without errors
#1

[eluser]terionm[/eluser]
I'm new to this and working thru tutorials , and I keep getting this error:

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\auto\system\application\controllers\users.php:33)

Filename: codeigniter/Common.php

Line Number: 360

what am I doing wrong I'm about to pull my hair out...
#2

[eluser]InsiteFX[/eluser]
Remove the trailing ?> and make sure there is no whitespace before the <?php tag.

InsiteFX
#3

[eluser]terionm[/eluser]
still nothing: here is the full error I'm getting:

load->model('Users'); } function index(){ // store data for being displayed on view file $data['users']=$this->Users->getUsers(); $data['numusers']=$this->Users->getNumUsers(); $data['title']='Displaying user data'; $data['header']='User List'; // load 'users_view' view $this->load->view('users_view',$data); } }
A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\auto\system\application\controllers\users.php:33)

Filename: codeigniter/Common.php

Line Number: 360


404 Page Not Found

The page you requested was not found.


I did everything exactly as the tutorial said named all the files just like the tutorial etc...
#4

[eluser]Cristian Gilè[/eluser]
Please, post the entire controller class and indent and highlight your code using bbcode in the formatting bar.


Cristian Gilè
#5

[eluser]terionm[/eluser]
Code:
class Users extends Controller{

function Users (){

// load controller parent

parent::Controller();

// load 'Users' model

$this->load->model('Users');

}

function index(){

// store data for being displayed on view file

  $data['users']=$this->Users->getUsers();

  $data['numusers']=$this->Users->getNumUsers();

  $data['title']='Displaying user data';

  $data['header']='User List';

// load 'users_view' view

  $this->load->view('users_view',$data);

}

}

I got this tutorial from devshed
http://www.devshed.com/c/a/PHP/Building-...amework/2/
#6

[eluser]Cristian Gilè[/eluser]
I don't see any error. This is a stupid question, I know, but, have you put <?php before the class statement?

Code:
<?php
class Users extends Controller{


Cristian Gilè
#7

[eluser]terionm[/eluser]
yes and no, I put it in, and I've taken it ...put it back...etc...which is right?
#8

[eluser]Cristian Gilè[/eluser]
Remove only the closing tag. The right code is:

Code:
<?php
class Users extends Controller{

function Users (){

// load controller parent

parent::Controller();

// load 'Users' model

$this->load->model('Users');

}

function index(){

// store data for being displayed on view file

  $data['users']=$this->Users->getUsers();

  $data['numusers']=$this->Users->getNumUsers();

  $data['title']='Displaying user data';

  $data['header']='User List';

// load 'users_view' view

  $this->load->view('users_view',$data);

}

}

As InsiteFX said before, make sure there is no whitespace before the <?php opening tag.


Cristian Gilè
#9

[eluser]terionm[/eluser]
not sure if this is right or means anything I named my files:

controller file: users.php

model: users_model.php

view: users_view.php

I thought that was the correct naming convention....
#10

[eluser]terionm[/eluser]
so I renamed the model to just users.php and now I get this error...this db table only has two records in it like the tutorial ...

load->database(); } function getAllUsers(){ $query=$this->db->get('users'); if($query->num_rows()>0){ // return result set as an associative array return $query->result_array(); } } function getUsersWhere($field,$param){ $this->db->where($field,$param); $query=$this->db->get('users'); // return result set as an associative array return $query->result_array(); } // get total number of users function getNumUsers(){ return $this->db->count_all('users'); } }
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 261904 bytes) in C:\xampp\htdocs\auto\system\codeigniter\Common.php on line 75




Theme © iAndrew 2016 - Forum software by © MyBB