Welcome Guest, Not a member yet? Register   Sign In
Parse error: syntax error, unexpected T_OBJECT_OPERATOR
#1

[eluser]Pensacola1989[/eluser]
I'm new to codeigniter ,get some problems,asking for help ,Thanks!
Code:
<?php
    class Mhome extends Model
    {
       function Mhome()
       {
         parent::Model();
       }
       function get_category()
       {
         $query=$this->db->query('SELECT * FROM category');
         return $query->result();
       }
       function get_article($category_id)
       {
         $query=$this-db->query("SELECT * FROM article WHERE category_id=$category_id");
         return $query->result();
       }
    }

the error message:
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in D:\wamp\www\demo\system\application\models\Mhome.php on line 15
#2

[eluser]wiredesignz[/eluser]
Code:
//$query=$this-db->query(...
$query=$this->db->query(...
#3

[eluser]Pensacola1989[/eluser]
Big Grin what's the problem?
#4

[eluser]tonanbarbarian[/eluser]
T_OBJECT_OPERATOR means that the $category_id must actually be an object and not a string
this means the issue is in the code that calls the get_article method of the model




Theme © iAndrew 2016 - Forum software by © MyBB