Title: Trouble with sql query
Last modified: August 19, 2016

---

# Trouble with sql query

 *  [blackfrog](https://wordpress.org/support/users/blackfrog/)
 * (@blackfrog)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/trouble-with-sql-query/)
 * Im sure that this is probably an easy problem, but I am at a loss. I have a call:
   `
   $result = $wpdb->insert( 'wp_post_accept', $dbfields);  which inserts all of 
   the rows just fine into the table, but when I try to get something out of the
   table, say:  $check = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM $wpdb-
   >post_accept"));
 * or
 * $check = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM $wpdb->wp_post_accept"));
 * I get nothing returned. I don’t know why this doesn’t work, because all of my
   other calls to tables that I didn’t create work just fine. Any help is appreciated

Viewing 1 replies (of 1 total)

 *  [vtxyzzy](https://wordpress.org/support/users/vtxyzzy/)
 * (@vtxyzzy)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/trouble-with-sql-query/#post-1954095)
 * I think that $wpdb->post_accept and $wpdb->wp_post_accept are both empty. Try
   using just wp_post_accept without the $wpdb->.

Viewing 1 replies (of 1 total)

The topic ‘Trouble with sql query’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [vtxyzzy](https://wordpress.org/support/users/vtxyzzy/)
 * Last activity: [15 years, 3 months ago](https://wordpress.org/support/topic/trouble-with-sql-query/#post-1954095)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
