CodeIgniter Forums

Full Version: I have a problem with $query->num_rows();
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[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.