Welcome Guest, Not a member yet? Register   Sign In
problem with model
#1

[eluser]dang2man[/eluser]
i have this code and when i tried to open it say

PHP Fatal error: Class 'Model' not found in C:\wamp\www\ci\application\models\mcat.php on line 2
<?php
class Mcat extends Model{

function __construct() {
parent::__construct();
}
function getCategory($id){
$data = array();
$options = array('id'=>$id);
$q = $this->db->getwhere('categories',$options,1);
if($q->num_row > 0){
$data = $q->row_array();
}
$Q-> free_result();
return $data;
}


function getAllCategories(){
$data = array();
$q = $this->db->get('categories');
if($q->num_row() > 0){
foreach ($q->result_array() as $rows){
$data = $rows;

}
$q = free_result();
return $data;
}

}

}


?>


i have added mcat in autoload.php
#2

[eluser]danmontgomery[/eluser]
CI_Model, not Model.

http://ellislab.com/codeigniter/user-gui...odels.html
#3

[eluser]dang2man[/eluser]
thanks noctrum its working now

but why i must put ci before model?
#4

[eluser]InsiteFX[/eluser]
Because the Blog your using was designed for CI 1.7.2 not CI 2.0.+

InsiteFX




Theme © iAndrew 2016 - Forum software by © MyBB