This is my login.php called from the button in the html below
$username = "root";
$password = "******";
$hostname = "localhost";
$dbname = "dbname";
// Create connection
$conn = new mysqli($hostname, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$Uname = $_POST['logId'];
$Upass = $_POST['logPass'];
$query= mysql_query("SELECT * FROM user WHERE RegId ='$Uname' AND RegPass ='$Upass'");
$numrows=mysql_num_rows($query);
if($numrows!=0) {
while($row=mysql_fetch_assoc($query)) {
$dbUser=$row['RegId'];
$dbPass=$row['RegPass'];
}
if($Uname == $dbUser && $Upass == $dbPass) {
include 'Home.html';
}
else {
echo "invalid username or password!";
}
}
$conn->close();
Here is the HTML code
<div class="container">
<div class="row">
<div class="col-md-4 col-md-offset-4">
<div class="login-panel panel panel-green">
<div class="panel-heading">
<h3 class="panel-title">Please Sign In</h3>
</div>
<div class="panel-body">
<form action="loginChk.php" method="post">
<div class="form-group">
<label>Please Enter Your Email/Username</label>
<input class="form-control" placeholder="username/E-mail" name="logId"/ >
</div>
<div class="form-group">
<label>Please Enter Your Password</label>
<input class="form-control" placeholder="Password" name="logPass" type="password" />
</div>
<div class="checkbox">
<label>
<input name="remember" type="checkbox" value="Remember Me" />Remember Me
</label>
</div>
<!-- Change this to a button or input when using this as a form -->
<input type="submit" class="btn btn-default" name="logBtn" value="Login"/><br /><br />
<div class="fb-login-button" data-max-rows="1" data-size="large" data-show-faces="false" data-auto-logout-link="false"></div><br /><br />
<a href="Register.html" class="btn btn-info ">Register Here!</a>
</form>
</div>
</div>
</div>
</div>
</div>
When i try to login using correct credentials it gives me this.....
Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\LifeGuru\loginChk.php on line 21
Any suggestions?