CodeIgniter + Eclipse: function num_rows() on a non-object

Home Forums Programming PHP & MySQL CodeIgniter + Eclipse: function num_rows() on a non-object

This topic contains 1 reply, has 1 voice, and was last updated by  Satish 4 years, 11 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1723

    Satish
    Keymaster

    Error:
    Fatal error: Call to a member function num_rows() on a non-object in C:\wamp\www\CI\application\models\site_model.php on line 8

    Solutions:
    Make sure of these basic things:
    in config -> database.php
    Make sure all the values are correct: I know you’ve entered it correct, but still carefully check it once again 🙂

    $db['default']['hostname'] = 'localhost';
    $db['default']['username'] = 'root';
    $db['default']['password'] = ''; // usually it'll not be set, so leave as it is and check once
    $db['default']['database'] = 'test'; // Common error. You have table by name test and you enter temp here :-)
    $db['default']['db_debug'] = FALSE; // yes set it to FALSE

    Now, config -> autoload.php
    $autoload['libraries'] = array('database');
    $autoload['helper'] = array('url');

    Fatal error: Call to a member function num_rows() on a non-object in C:\wamp\www\CI\application\models\site_model.php on line 8
    This error is commonly caused due to database errors..usually not able to connect to database! So check it carefully.

    #1727

    Satish
    Keymaster

    This error also occurs when there is no data returned from the table.. i.e., when there is no data inside the table to return!
    So first insert something into the database, specify proper field names while retrieving the data.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.