WordPress.org

Support

Support » How-To and Troubleshooting » trying to query custom table

trying to query custom table

  • I am trying to query a custom table in my wordpress db. Currently my result is returning null. Does anyone have any ideas why?

    Here is my code:

    $query = "SELECT * FROM photos";
    global $wpdb;
    $result = $wpdb->get_results( $query , ARRAY_A );
    $wpdb->show_errors();
    if(!$result) {
        die('invalid query');
    }

    Thanks a lot

  • The topic ‘trying to query custom table’ is closed to new replies.