i am trying to make a simple selection in a wordpress table (created by a plugin). the table is named reduceri
, and has the following columns: id
, post
, category
.
so, i am trying to take all the category values, when the post is equal to the current post id.
the way i am doing the query is:
$the_query = "
SELECT $wpdb->reduceri.category
FROM $wpdb->reduceri
WHERE $wpdb->reduceri.post = ".$post_id."
";
$my_reduceri = $wpdb->get_results($the_query);
but when i var_dump
the $my_reduceri
all i get is an empty array: array(0) { }
even though there should actually be some results… any idea where i am wrong (in the query)?
thank you
Did you declared global $wpdb; before using this query?