php - Why is this is this retrurning Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in 14 and how can i fix it? -
<?php $servername = "mysql7.000webhost.com"; $username = "a1483525_iwatch"; $password = "hji"; $dbname = "a1483525_iwatch"; $val = $_get['userid']; $hi = mysql_connect($servername, $username, $password, $dbname); $checkuserid = mysql_query("select userid `callbans` userid = '$val'"); if (mysqli_num_rows($checkuserid) > 0) { echo "user id exists already."; $user = mysqli_fetch_array($checkuserid); print_r($user); // data returned query } ?>
how come not working, full error is:
warning: mysql_num_rows(): supplied argument not valid mysql result resource in /home/a1483525/public_html/emp/servadv/callban/isbanned.php on line 14
$checkuserid
not same $checkuserid
. is, 2 lines should be
$checkuserid = mysql_query("select userid `callbans` userid = '$val'"); if (mysql_num_rows($checkuserid) > 0) {
because php variable names case sensitive.
additionally, remiss if didn't mention mysql_
functions deprecated.