WordPress.org

Ready to get started?Download WordPress

Forums

WPDB -class problems (1 post)

  1. risehigher
    Member
    Posted 7 years ago #

    Hi,

    at the moment Im writing a plugin which needs database access.
    I tried to use the wpdb-class and have already set $wpdb global.

    Here's the code:

    <--snip-->
    function foo() {
    global $wpdb;
    $wpdb->query('SELECT * FROM table');
    }
    foo();
    <--snap-->

    This Error returns:
    "Call to a member function query() on a non-object in[..]"

    Thanks in advance.

    .risehigher.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags