I want to count the number of rows of this custom wordpress query and it does not work:
*PS I am accessing a custom table inside my wordpress database, mabe by myself. The $wpdb->get_results part works.*
$myquery = $wpdb->get_results("SELECT COUNT(*) FROM `$table` WHERE $myconditions");
$nr = $myquery->num_rows;
Any ideas why?
Important: using $wpdb->get_results like this:
- Do I need to prepare the query (i read it in the codex)?
- Do I need to somehow reset the query after I have used it?
Ty for helping!