Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, bool given in C:\xampp\htdocs\REVIEW\index.php on line 16
<?php $servername = "localhost"; $username = ""; $password = ""; $remarks= ""; $con = mysqli_connect('localhost', 'root', '', 'firstdb'); if (!$con) { die("Connection failed: " . mysqli_connect_error()); } if(!(empty($_POST["uname"]) && empty($_POST["pin"]))) { $UN=$_POST["uname"]; $PW=$_POST["pin"]; $sql = "SELECT * FROM users WHERE username=''".$UN." AND password=''".$PW. ";"; $result = mysqli_query($con, $sql); if (mysqli_num_rows($result) > 0) { header( "Location: Main.php" ); } $remarks ="Sorry. Unrecognized username or password.Please try again"; } ?> <html> <body> <form action="index.php" method="post"> <fieldset> <legend>Registration Details:</legend> <label for="uname">Username:</label><br> <input type="text" id="uname" name="uname" ><br> <label for="pin">PIN Code:</label><br> <input type="password" id="pin" name="pin" <br><br> <input type="submit" value="Register"> <br> <label ><?php echo $remarks; ?></label><br></fieldset> </form> </body> </html>
Quote: PHP $sql = "SELECT * FROM users WHERE username=''".$UN." AND password=''".$PW. ";";
$sql = "SELECT * FROM users WHERE username=''".$UN." AND password=''".$PW. ";";
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)