CodeIgniter Forums
query error - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forum-21.html)
+--- Thread: query error (/thread-27645.html)



query error - El Forum - 02-16-2010

[eluser]basty_dread[/eluser]
i use this query

Code:
function checkifkewordlist(&$islist,$keyno){
            $this->internalvalidate();
            $query = $this->db->query("select iKeywordList from tblkeywords where iKeywordNo = ".$keyno);
            $row = $query->row();
            $islist = $row->iKeywordList;
        }


this is the error:

Code:
Severity: Notice
Message: Trying to get property of non-object

how this become an error?

what could possibly wrong?


query error - El Forum - 02-16-2010

[eluser]theprodigy[/eluser]
if your query returns an error, it won't be an object, and as such won't have the iKeywordList property.


query error - El Forum - 02-16-2010

[eluser]basty_dread[/eluser]
what could be wrong with my query?


query error - El Forum - 02-16-2010

[eluser]theprodigy[/eluser]
Quote:function checkifkewordlist(&$islist,$keyno){
$this->internalvalidate();
$query = $this->db->query("select iKeywordList from tblkeywords where iKeywordNo = ".$keyno);
print_r($query); <----- This will tell you what could be wrong.
$row = $query->row();
$islist = $row->iKeywordList;
}
Now just remember, I never said there WAS something wrong with your query. I merely suggested a possible reason why you are getting the error you are.

But if you put your print_r (as I did up above), you may see what is going on.


query error - El Forum - 02-16-2010

[eluser]basty_dread[/eluser]
ok thanks for the help, i will see what is error.. thanks


query error - El Forum - 02-16-2010

[eluser]basty_dread[/eluser]
here is what i printed

Code:
CI_DB_mysql_result Object ( [conn_id] => Resource id #28 [result_id] => Resource id #43 [result_array] => Array ( ) [result_object] => Array ( ) [current_row] => 0 [num_rows] => 0 [row_data] => )