[eluser]fariad22[/eluser]
I was learning a tutorial and i found this problem but not understanding wht is ths?
Fatal error: Cannot redeclare class Users in D:\xampp\htdocs\projects\Clients\CodeIgnitor\CodeIgniter_1.7.1\system\application\models\Users.php on line 80
------------------
The code is here
-----
for model class
class Users extends Model{
function Users(){
// call the Model constructor
parent::Model();
// load database class and connect to MySQL
$this->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');
}
}
----
for controller class
---
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);
}
}
please tell me wht actually is and i don't get the logic behind this.