Title: SQL query help
Last modified: August 19, 2016

---

# SQL query help

 *  Resolved [mikestoke](https://wordpress.org/support/users/mikestoke/)
 * (@mikestoke)
 * [16 years, 1 month ago](https://wordpress.org/support/topic/sql-query-help-2/)
 * I’m trying to run a SQL query to return an integer from the database, this is
   my query
 * `$score = $wbdb->get_results("SELECT review FROM wp_gdsr_data_article WHERE post_id
   = {$post->ID}");`
 * I’m guessing the issue is the $post->ID since it seems to be empty when echoed
   but it is used further down in other code :/
 * I’m pretty new to WordPress so try to avoid using jargon if possible haha 🙂

Viewing 1 replies (of 1 total)

 *  Thread Starter [mikestoke](https://wordpress.org/support/users/mikestoke/)
 * (@mikestoke)
 * [16 years, 1 month ago](https://wordpress.org/support/topic/sql-query-help-2/#post-1472014)
 * Resolved from IRC chat, stupid mistake “wbdb” instead of “wpdb” -_-

Viewing 1 replies (of 1 total)

The topic ‘SQL query help’ is closed to new replies.

## Tags

 * [database](https://wordpress.org/support/topic-tag/database/)
 * [MySQL](https://wordpress.org/support/topic-tag/mysql/)
 * [sql](https://wordpress.org/support/topic-tag/sql/)
 * [word](https://wordpress.org/support/topic-tag/word/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 1 participant
 * Last reply from: [mikestoke](https://wordpress.org/support/users/mikestoke/)
 * Last activity: [16 years, 1 month ago](https://wordpress.org/support/topic/sql-query-help-2/#post-1472014)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
