WordPress.org

Ready to get started?Download WordPress

Forums

Fatar error mysql table (3 posts)

  1. telecotech
    Member
    Posted 1 year ago #

    hi,

    i have some trouble with my php, it give me php error message like this "Fatal error: Call to a member function get_results() on a non-object..."
    and my code, to print data from my table

    global $wpdb;
    $result = $wpdb->get_results( "SELECT * FROM MyTable ");
    foreach($result as $row)
    {
    echo $row->name." ".$row->id."";
    }
    ?>

    any one can solve it, thanks

  2. Your getting that error because the $wpdb object has not been instantiated yet. Where is this code? Is this from a PHP file that is not loaded from WordPress?

  3. telecotech
    Member
    Posted 1 year ago #

    i don't know the way intagrating mysql and wordpress. i uploaded this php file in a hosting. i wanna make a post that include my new table from mysql database, could you tell me the way?

Topic Closed

This topic has been closed to new replies.

About this Topic