Title: $wpdb error but without description
Last modified: August 19, 2016

---

# $wpdb error but without description

 *  [srkan](https://wordpress.org/support/users/srkan/)
 * (@srkan)
 * [18 years, 2 months ago](https://wordpress.org/support/topic/wpdb-error-but-without-description/)
 * I have the WordPress 2.5 installed in my server.
 * I’ve inserted the following code in my template
 * `$getL1 = $wpdb->get_results("SELECT wposts.* FROM $wpdb->posts wposts, $wpdb-
   >postmeta wpostmeta WHERE wposts.ID = wpostmeta.post_id AND wpostmeta.meta_key
   = 'nivelChamada' AND wpostmeta.meta_value = 'L1' AND wposts.post_status = 'publish'
   AND wposts.post_date <= NOW() ORDER BY wposts.post_date DESC LIMIT 1", OBJECT);`
 * but when I get a preview in template, I have the following error:
 *     ```
       WordPress database error: []
       SELECT wp.* FROM wp_posts AS wp, wp_postmeta AS wpm WHERE wp.ID = wpm.post_id AND wpm.meta_key LIKE 'nivelChamada' AND wpm.meta_value LIKE 'L1' AND wp.post_status LIKE 'publish' AND wp.post_date <= NOW() ORDER BY wp.post_date DESC LIMIT 1
       ```
   
 * What can be it?
 * I have the same query in the same template and in the same WordPress version (
   2.5) and it’s working.
 * Anyone can help me? Please?
 * Tks
 * Kan Ishigami

Viewing 1 replies (of 1 total)

 *  Thread Starter [srkan](https://wordpress.org/support/users/srkan/)
 * (@srkan)
 * [18 years, 2 months ago](https://wordpress.org/support/topic/wpdb-error-but-without-description/#post-740538)
 * Sorry the correct code is the following:
 * `$getL1 = $wpdb->get_results("SELECT wp.* FROM $wpdb->posts AS wp, $wpdb->postmeta
   AS wpm WHERE wp.ID = wpm.post_id AND wpm.meta_key LIKE 'nivelChamada' AND wpm.
   meta_value LIKE 'L1' AND wp.post_status LIKE 'publish' AND wp.post_date <= NOW()
   ORDER BY wp.post_date DESC LIMIT 1", OBJECT);`
 * and the error is:
 *     ```
       WordPress database error: []
       SELECT wp.* FROM wp_posts AS wp, wp_postmeta AS wpm WHERE wp.ID = wpm.post_id AND wpm.meta_key LIKE 'nivelChamada' AND wpm.meta_value LIKE 'L1' AND wp.post_status LIKE 'publish' AND wp.post_date <= NOW() ORDER BY wp.post_date DESC LIMIT 1
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘$wpdb error but without description’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 1 participant
 * Last reply from: [srkan](https://wordpress.org/support/users/srkan/)
 * Last activity: [18 years, 2 months ago](https://wordpress.org/support/topic/wpdb-error-but-without-description/#post-740538)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
