wpdb num_rows 1

wpdb num_rows

global $wpdb;
$wpdb->get_results("
                    SELECT * FROM " . $wpdb->prefix . "product_order 
                        WHERE 
                        rel = '" . $post["id"] . "' AND 
                        `range` = '" . $range . "' AND 
                        category = '" . $range . "'
                "); 

echo $wpdb->num_rows;

Here is what the above code is Doing:
1. It’s getting the number of rows from the database where the rel is the same as the id of the post, the range is the same as the range, and the category is the same as the category.
2. It’s echoing the number of rows.

Similar Posts