number of rows

PHOTO EMBED

Sat Sep 25 2021 22:18:36 GMT+0000 (UTC)

Saved by @khalidlogi

### Search for IP in database
function postviews_get_ip($id, $ip) {
    global $post, $wpdb;

    $rowcount = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->wp_postviews_ips WHERE postid = $id AND ip = '$ip'");

    return $rowcount;
}

postviews_get_ip($id, $_SERVER['REMOTE_ADDR']);
//both $id and $_SERVER['REMOTE_ADDR']) return the values I'm searching for in the database
content_copyCOPY

https://wordpress.stackexchange.com/questions/131687/how-to-return-number-of-found-rows-from-select-query