Forums

[resolved] $wpdb returning null... (5 posts)

  1. matthewvanb
    Member
    Posted 2 years ago #

    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?

  2. matthewvanb
    Member
    Posted 2 years ago #

    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..

  3. rcaf
    Member
    Posted 2 years ago #

    add the file wp-load.php,

    for example:

    require_once('../../wp-load.php');

  4. rcaf
    Member
    Posted 2 years ago #

  5. matthewvanb
    Member
    Posted 2 years ago #

    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....

Topic Closed

This topic has been closed to new replies.

About this Topic