Title: $wpdb returning null&#8230;
Last modified: August 19, 2016

---

# $wpdb returning null…

 *  Resolved [matthewvanb](https://wordpress.org/support/users/matthewvanb/)
 * (@matthewvanb)
 * [16 years, 8 months ago](https://wordpress.org/support/topic/wpdb-returning-null/)
 * I’m creating a calander plugin, and on the first line of one of my PHP pages,
   I declare the $wpdb global so I can use a select statment to grab the data I 
   need from the database… for some reason it says that the $wpdb global is null…
 * here’s the code…
 *     ```
       <?php
       global $wpdb;
       var_dump($wpdb);
       ?>
       ```
   
 * this declared on the very first line of the file… any suggestions?

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Thread Starter [matthewvanb](https://wordpress.org/support/users/matthewvanb/)
 * (@matthewvanb)
 * [16 years, 8 months ago](https://wordpress.org/support/topic/wpdb-returning-null/#post-1224912)
 * just for clarification, I figured this out because when I tried to use wpdb->
   prefix it wasn’t returning the tables prefix into the select statement. That’s
   when I tried using the var_dump($wpdb) to see what it would return, and it told
   me it was NULL..
 *  [rcaf](https://wordpress.org/support/users/rcaf/)
 * (@rcaf)
 * [16 years, 8 months ago](https://wordpress.org/support/topic/wpdb-returning-null/#post-1225074)
 * add the file wp-load.php,
 * for example:
 * require_once(‘../../wp-load.php’);
 *  [rcaf](https://wordpress.org/support/users/rcaf/)
 * (@rcaf)
 * [16 years, 8 months ago](https://wordpress.org/support/topic/wpdb-returning-null/#post-1225075)
 * [http://wordpress.org/support/topic/314470?replies=4](http://wordpress.org/support/topic/314470?replies=4)
 *  Thread Starter [matthewvanb](https://wordpress.org/support/users/matthewvanb/)
 * (@matthewvanb)
 * [16 years, 7 months ago](https://wordpress.org/support/topic/wpdb-returning-null/#post-1225082)
 * you are a life saver! thanks.
 * would you by chance know anything about creating “veiws”?
 * a little explanation: like with the podcasting plugin, you place the “[podcast
   file]” code where you want the podcast file to be played….
 * how do you create the [podcast file] code?
 * I wanted the user to be able the type of calendar they wanted, and based off 
   of their choices, create a [calendar view] code that would reflect there choice
   of options for that calander….

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘$wpdb returning null…’ is closed to new replies.

## Tags

 * [wpdb](https://wordpress.org/support/topic-tag/wpdb/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 2 participants
 * Last reply from: [matthewvanb](https://wordpress.org/support/users/matthewvanb/)
 * Last activity: [16 years, 7 months ago](https://wordpress.org/support/topic/wpdb-returning-null/#post-1225082)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
