database driven application using code igniter framework |
[eluser]subhashramesh[/eluser]
Hi all, I am new to code igniter framework and i tried INTRODUCTION TO CODEIGNITER PHP FRAMEWORK PART2-databses,which is in http://www.devshed.com/c/a/PHP/Building-...Framework/ and i am unable to run application by using url as https://localhost/CodeIgniter_1.7.1/index.php/Users gtting error as 404 PAGE NOT FOUND. in models folder i put file as Users.php as follows class Users extends Model{ function Users(){ parent::Model(); $this->load->database(); } function getAllUsers(){ $query=$this->db->get('sample'); if($query->num_rows()>0){ return $query->result_array(); } } function getUsersWhere($field,$param){ $this->db->where($field,$param); $query=$this->db->get('sample'); return $query->result_array(); } function getNumUsers(){ return $this->db->count_all('sample'); } } in controllers folder i put file Users.php as follows class Users extends Controller{ function Users (){ parent::Controller(); $this->load->model('Users'); } function index(){ $data['users']=$this->Users->getUsers(); $data['numusers']=$this->Users->getNumUsers(); $data['title']='Displaying user data'; $data['header']='User List'; $this->load->view('users_view',$data); } } In views folder i put file as users_view.php as follows. <html> <head> <title><?php echo $title;?></title> </head> <body> <h1><?php echo $header;?></h1> <ul> <?php foreach($users as $user):?> <li> <p><?php echo $user['a'].' '.$user['b'].$user['c'];?></p> </li> <?php endforeach;?> </ul> <p><?php echo 'Total number of users :'.$numusers;?></p> </body> </html> in above sample is table in efo databse with 3 columas a,b,c respectively. could you please help to solve above problem. |
Messages In This Thread |
database driven application using code igniter framework - by El Forum - 08-27-2009, 12:22 AM
database driven application using code igniter framework - by El Forum - 08-27-2009, 12:50 AM
database driven application using code igniter framework - by El Forum - 08-27-2009, 12:53 AM
database driven application using code igniter framework - by El Forum - 08-27-2009, 02:44 AM
database driven application using code igniter framework - by El Forum - 08-31-2009, 05:16 AM
|