<?php
include ( './includes/template_pageTop.php' );
if (isset($_POST['submit'])) {
$username = $_POST['username'];
$password = $_POST['password'];
$check_username = mysql_query("SELECT username FROM users WHERE username='$username'");
$numrows = mysql_num_rows($check_username);
if ($numrows != 1) {
echo 'That User doesn\'t exist.';
}
else
{
$check_password = mysql_query("SELECT password FROM users WHERE password='$password' && username='$username'");
while ($row = mysql_fetch_assoc($check_password)) {
$password_db = $row['password'];
if ($password_db == $password) {
echo 'You can log the user in';
}
}
}
}
?>
I am trying to create a login using this code and I keed getting this error "Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/a9600273/public_html/login.php on line 8".
I can see lots of threads on here about this kind of error, but I can't seem to fix this.
Any ideas?
Thanks.