Codeigniter model class through this error

A PHP Error was encountered

Severity: Notice

Message: Undefined property: FirstController::$db

Filename: core/Model.php

Line Number: 77

Backtrace:

File: F:\xammp\htdocs\project\codeIgniter\application\models\FirstModel.php
Line: 18
Function: __get

File: F:\xammp\htdocs\project\codeIgniter\application\controllers\FirstController.php
Line: 36
Function: insertDataQuery

File: F:\xammp\htdocs\project\codeIgniter\index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: Notice

Message: Undefined property: FirstController::$db

Filename: core/Model.php

Line Number: 77

Backtrace:

File: F:\xammp\htdocs\project\codeIgniter\application\models\FirstModel.php
Line: 18
Function: __get

File: F:\xammp\htdocs\project\codeIgniter\application\controllers\FirstController.php
Line: 36
Function: insertDataQuery

File: F:\xammp\htdocs\project\codeIgniter\index.php
Line: 315
Function: require_once

Have you loaded your model?

I usually load it in ./config/autoload.php

<?php 
// autoload.php
  $autoload['model'] = array('FirstModel');

// and later call it like this:
$query  = $this->m_lib->FirstController(...);

Have you set the ./config/config.php → $config['log_threshold'] = 1; and inspected the log file?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.