I am following along with a tutorial series here: https://www.youtube.com/watch?feature=player_embedded&v=bribF8a3fgo and I am using the below code, and yes, i know there are better ways to do this. Although I am getting this error:
Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in /Applications/XAMPP/xamppfiles/htdocs/friends/login.php on line 26
Im not sure why, Im pretty sure I am typing everything right, but I'm not sure. Mind taking a look? Thanks.
<html>
<head>
<title>Login - Friend System</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<?php include 'connect.php'; ?>
<?php include 'functions.php'; ?>
<?php include 'header.php'; ?>
<div class="container">
<h3>Login</h3>
<form method="post">
<?php
if (isset($_POST['submit'])) {
$username = $_POST['username'];
$password = $_POST['password'];
if (empty($username) or empty($password)) {
$message = "Fields Empty, Please Recheck";
}else {
$check_login = mysql_query("SELECT id FROM users WHERE username='$username' AND password='" . md5($password) . "'");
if(mysql_num_rows($check_login) == 1) {
$message = "Ok!";
} else {
$message = "Username and/or password incorrect!";
}
}
echo "<div class='box'>" . $message . "</div>";
}
?>
Username: <br/>
<input type="text" name="username" autocomplete="off"/>
<br/><br/>
Password: <br/>
<input type="password" name="password" />
<br/><br/>
<input type="submit" name="submit" value="Register">
</form>
</div>
</body>
</html>
Line 26 is:
if(mysql_num_rows($check_login) == 1) {