Some things about $wpdb

  1. You need to globalise the variable $wpdb by adding global $wpdb; before you do anything.
  1. If you are trying to access a custom table (created by a plugin or something else) you must add the name of the table to the $wpdb object:
$wpdb->nameofyoucustomtable = 'wp_nameofyoucustomtable'; // you may not need the wp_ if you arn't using a wordpress table

Leave a Reply

You must be logged in to post a comment.