[Help] User System ERROR

Status
Not open for further replies.

1tom1

Member
Mar 11, 2011
112
8
I'm starting on my first PHP development, I'm a PHP newbie.

I have started on the index page/ login, but I get an error,
Code:
Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in D:\xampp\htdocs\user\index.php on line 44

Part of the code, near the error,
Code:
if ($_POST['loginbtn']) {
$user = $_POST['user'];
$password = $_POST['password'];
 
if ($user) {
if ($password) {
 
require("config.php");
 
$password = md5(md5(md5("1x2y3z".$password."1x2y3z")));
 
//The Login Info Checking
$query = mysql_query("SELECT * FROM user WHERE username='$user')");
$numrows = mysql_num_rows($query);
if ($numrows == 1){
$row = mysql_fetch_assoc($query);
$dbuser = $row['username'];
$dbpass = $row['password'];
$dbactive = $row['active'];
$dbid = $row['id'];
 
if ($password == $dbpass) {
if ($dbactive == 1) {
 
$_SESSION['username'] = $dbuser;
$_SESSION['id'] = $dbid;
 
echo "You have been logged in as <b>$dbuser</b>";
 
}
else
echo "You need to activeate your account.";
}
else
echo "Invalid Password. $form";
}
else
echo "Invalid Username. $form";
 
mysql_close();
 
}
else
echo "You must put in a Password. $form";
}
else
echo "You must put in a Username. $form";
}
else 
echo $form;

Please help me - Like for a helpful reply
 
Status
Not open for further replies.

Users who are viewing this thread

Top