CodeIgniter Forums
I have a problem with $query->num_rows(); - 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: I have a problem with $query->num_rows(); (/showthread.php?tid=9431)



I have a problem with $query->num_rows(); - El Forum - 06-25-2008

[eluser]Unknown[/eluser]
In hosting I have this code:
Code:
48: $query = $this->db->query('SELECT * FROM table where field="'.$query_string.'" LIMIT 1');
49:        if ($query->num_rows()==0)
50:         {
...

After run this code and if SELECT command return noany data record - error occures:

Fatal error: Call to a member function num_rows() on a non object in file1 on line 49

This code works fine in my developer computer. What's wrong? CI 1.6.2.