wpdb count

Solutions on MaxInterview for wpdb count by the best coders in the world

showing results for - "wpdb count"
Warren
11 May 2016
1### Search for IP in database
2function postviews_get_ip($id, $ip) {
3    global $post, $wpdb;
4
5    $ipquery= $wpdb->get_results("SELECT * FROM $wpdb->wp_postviews_ips WHERE postid = $id AND ip = '$ip'");
6    $rowcount = $ipquery->num_rows;
7    return $rowcount;
8}
9
10postviews_get_ip($id, $_SERVER['REMOTE_ADDR']);
11//both $id and $_SERVER['REMOTE_ADDR']) return the values I'm searching for in the database