CodeIgniter Forums
DATABASE CONNECTIVITY - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: DATABASE CONNECTIVITY (/showthread.php?tid=14821)



DATABASE CONNECTIVITY - El Forum - 01-16-2009

[eluser]barun the michael[/eluser]
My myart_model is inside the models folder but though I am getting error like this Fatal error: Class 'Myart_model' not found in C:\wamp\www\CodeIgniter_1.6.3\CodeIgniter_1.6.3\system\libraries\Loader.php on line 177 Please help me.........


DATABASE CONNECTIVITY - El Forum - 01-16-2009

[eluser]majidmx[/eluser]
Double check all the spelling and capital/small cases in you file-name/class-name/ and loadings.

refering to user manual you can find this :
Quote:Where Model_name is the name of your class. Class names must have the first letter capitalized with the rest of the name lowercase. Make sure your class extends the base Model class.

The file name will be a lower case version of your class name.
It's from CI 1.7 though, you should check your corresponding version's manual/


DATABASE CONNECTIVITY - El Forum - 01-17-2009

[eluser]barun the michael[/eluser]
Hi

I am using codeigniter version 1.6.3 and my model name is myart_model and writing class like this class Myart_model extends Model {

function Myart_model()
{
parent::Model();
}
function get_MyartData()
{
$sql = "SELECT * FROM users ";

$query = $this->db->query($sql);

//echo $query->num_rows();
//echo $str = $this->db->last_query();
if ($query->num_rows() > 0)
{
$result = array();
foreach ($query->result_array() as $row)
{
array_push($result,$row);
}
$query->free_result();
return $result;
}
else
return false;
}
}

This is my model code and its name is myart_mode.php

Here is my controller code
class Myart extends Controller
{
var $error_string = "";
function Myart()
{
parent::Controller();
//$this->freakauth_light->check();
}
function index()
{
$this->load->model('myart_model');
$data['myart'] = array();
$data['error_string'] = $this->error_string;
$data['myart'] = $this->myart_model->get_MyartData();

//$this->assetlibpro->add_css('css/backend.css');

$this->output->enable_profiler(FALSE);

//$header['title'] = 'Welcome to Myart4Home';

//$this->load->view('header_view',$header);

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

//$this->load->view('footer_view');

}


DATABASE CONNECTIVITY - El Forum - 01-17-2009

[eluser]Colin Williams[/eluser]
Quote:This is my model code and its name is myart_mode.php

Perhaps an 'l' is needed: myart_model.php