mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in C:\x

when run my simple login php script i got the error msg showing “mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in C:\xampp\htdocs\login1.php on line 6”.

my login.php code is as below

<?php $username=$_POST['un1']; $password=$_POST['pw1']; $con=mysql_connect("localhost","root","root","pratyush"); $query = mysql_query("select * from user_details where password='$password' AND username='$username'", $con); $rows = mysqli_num_rows($query); if ($rows == 1) { echo"Welcome"; } else { echo"not match"; } ?>

please help me.

Here you are using the old mysql

Here you are using the mysqli version.

Just place an ‘i’ on the first two.
Hope that helps,
Red :wink:

Sponsor our Newsletter | Privacy Policy | Terms of Service