• I am trying to request things from the database. But it does not working. Is there anything I am doing wrong? If so how would I get the information from the database and display it on a page.

    function retrieve_requests(){
    global $wpdb;

    $query = (“SELECT id, name, request FROM $wpdb->my_table ORDER BY id”);

    $rows = $wpdb->get_results($query, OBJECT);

    foreach($rows as $row){
    echo $row->id;
    echo $row->name;
    echo $row->request;
    }
    }

    retrieve_requests();

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator James Huff

    (@macmanx)

    Volunteer Moderator

    Can you let us know what you’re trying to do, as there is probably already an internal function for it.

    Thread Starter JohnnyWhite2007

    (@johnnywhite2007)

    Ok let me give the rundown.

    PLUGIN (Admin Panel)
    –PLUGIN (Sub-panel that displays entries in the database, doesn’t work)
    –ADD Entry(Sub-panel adds entries in the database, this works)

    The page that the plugin is suppose to display the entries in the table. It would display it as:

    Name —– Request
    John Doe – Please remember to take the trash out.

    The function above is suppose to connect to the database and then select the table and get the rows and display them on the page.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Cannot output database entries.’ is closed to new replies.