Welcome Guest, Not a member yet? Register   Sign In
un - understandable error
#1

[eluser]Unknown[/eluser]
I have some error
Begin working with CI 1.6.3
Have made such controller

Code:
class Leftblock extends Controller {

         function __construct()
           {
               parent::Controller();
               $this->load->model('Leftblock_model');
           }
      
      
        function index()
         {    
           $id = $_SESSION['id'];
           $rows = $this->Leftblock_model->get_asc($id);
          
           foreach ($rows as $row)
            {
                if ($row->position != 0)
                {
                $block = $row->blockname;
                include $block.".php";
                $$block = new $block();
                $$block->index();
                }
              
            }
         }
    }


and such model:

Code:
class Leftblock_model extends Model {
      
    public $id = '';  
    public $blockname = '';
    public $idMenu = '';
    public $position = '';
    private $table = 'leftblock';
      
        function __construct()
            {
                 parent::Model();
            }
          
        function get_asc($where)
            {
                $this->idMenu = $where;
                $this->db->where('idMenu',$this->idMenu);
                $this->db->order_by('position','asc');
                $query = $this->db->get($this->table);
                return $query->result();            
            }
          
        function get_desc($where)
            {
                $this->idMenu = $where;
                $this->db->where('idMenu',$this->idMenu);
                $this->db->order_by('position','desc');
                $query = $this->db->get($this->table);
                return $query->result();
            }  
    }


when i am trying to start it i have such error:

Quote: A PHP Error was encountered

Severity: Notice

Message: Undefined property: Leftblock_model::$db

Filename: models/leftblock_model.php

Line Number: 18

Fatal error: Call to a member function where() on a non-object in c:\program files\Server\Apache\Apache\htdocs\derevo\system\application\models\leftblock_model.php on line 18



in autoload.php i have: $autoload['libraries'] = array('database');

what is my error? how to edit it? how to make it work?
my database.php is correct




Theme © iAndrew 2016 - Forum software by © MyBB