CodeIgniter Forums

Full Version: problem with model
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[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

El Forum

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

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

El Forum

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

but why i must put ci before model?

El Forum

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

InsiteFX