Wordpress $wpdb->get_results and num_rows
问题 I'm using the following code: $wpdb->get_results(" SELECT * FROM " . $wpdb->prefix . "product_order WHERE rel = '" . $post["id"] . "' AND `range` = '" . $range . "' AND category = '" . $range . "' "); echo $wpdb->num_rows; num_rows returns 1 even though there is no rows in the database? Any ideas? The variables I am putting in look fine. so it should be querying correctly. 回答1: global $wpdb; $wpdb->get_results(" SELECT * FROM " . $wpdb->prefix . "product_order WHERE rel = '" . $post["id"] . "