Title: WPDB -class problems
Last modified: August 18, 2016

---

# WPDB -class problems

 *  [risehigher](https://wordpress.org/support/users/risehigher/)
 * (@risehigher)
 * [19 years, 10 months ago](https://wordpress.org/support/topic/wpdb-class-problems/)
 * 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.

The topic ‘WPDB -class problems’ is closed to new replies.

## Tags

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

 * 0 replies
 * 1 participant
 * Last reply from: [risehigher](https://wordpress.org/support/users/risehigher/)
 * Last activity: [19 years, 10 months ago](https://wordpress.org/support/topic/wpdb-class-problems/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
