Title: querying database
Last modified: August 18, 2016

---

# querying database

 *  Resolved [iLobster](https://wordpress.org/support/users/ilobster/)
 * (@ilobster)
 * [19 years, 4 months ago](https://wordpress.org/support/topic/querying-database/)
 * I’m setting up a plugin where I had to set up some additional tables. I need 
   to query those tables. how do I do so?
    I’m sure there’s something in the codex,
   but i wasn’t able to find it. I tried $wpdb->query($query); but it’s making the
   script fail.

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

 *  [WordPressor](https://wordpress.org/support/users/dt34d/)
 * (@dt34d)
 * [19 years, 4 months ago](https://wordpress.org/support/topic/querying-database/#post-485262)
 * What is result of your queries to standart WP tables?
 *  [WordPressor](https://wordpress.org/support/users/dt34d/)
 * (@dt34d)
 * [19 years, 4 months ago](https://wordpress.org/support/topic/querying-database/#post-485263)
 * This is my code:
 * ini_set( display_errors, true );
    require(‘wp-blog-header.php’); $r = $wpdb->
   query(“SELECT * from LUM_Category”); print ‘<pre>’; print_r( $r ); print ‘</pre
   >’;
 * It prints ‘6’. It’s right, there are 6 records in that table (categories table
   of Vanilla forum).
 *  Thread Starter [iLobster](https://wordpress.org/support/users/ilobster/)
 * (@ilobster)
 * [19 years, 4 months ago](https://wordpress.org/support/topic/querying-database/#post-485279)
 * wow, I was so stupid, I forgot to make it global 😉
    That’s what happens when
   you don’t have time to sleep 😉 Thanks.

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

The topic ‘querying database’ is closed to new replies.

 * 3 replies
 * 2 participants
 * Last reply from: [iLobster](https://wordpress.org/support/users/ilobster/)
 * Last activity: [19 years, 4 months ago](https://wordpress.org/support/topic/querying-database/#post-485279)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
