if(isset($_POST["login"])){ if(!empty($_POST['username']) && !empty($_POST['password'])) { $username=htmlspecialchars($_POST['username']); $password=htmlspecialchars($_POST['password']); $query =mysqli_query($con, "SELECT * FROM usertbl WHEREusername='".$username."' AND password='".$password."'"); $numrows=mysqli_num_rows($query); if($numrows!=0) { while($row=mysqli_fetch_assoc($query)) { $dbusername=$row['username']; $dbpassword=$row['password']; } 

It gives an error mysqli_num_rows () expects parameter 1 to be mysqli_result, etc. Where is the error?

Reported as a duplicate by Visman participants, Alexey Shimansky , br3t , AK , αλεχολυτ Jul 25 '17 at 19:22 .

A similar question was asked earlier and an answer has already been received. If the answers provided are not exhaustive, please ask a new question .

  • Thank you) found myself "SELECT * FROM usertbl WHEREusername = after WHERE there is no space) - Alex Stassov

1 answer 1

"SELECT * FROM usertbl WHEREusername = '". $ Username. "' AND password = '". $ Password. "" ");

Request is incorrect. correct SELECT * FROM usertbl WHERE username =