ok, I'm making a 'user control panel' driven by PHP and a mysql database. I keep on getting the same error, so I REALLY would appreciate you guys' help.
this is the form code, coded in HTML only:
<head><title>Administrator Login</title></head>
<body>
<form method="post" action="admincp.php">
Username: <input type="text" name="user" size="20"><br>
Password: <input type="password" name="password" size="20"><br>
<input type="submit" value="Log-on">
</body>
I've had no problem with that code. This is where I get the problem, it's the admincp.php page wich you can see is used after the login attempt:
<?php
$db_name = "novazro";
$connect = mysql_connect('localhost','login removed','password removed');
$db = mysql_select_db($db_name,$connect);
?>
<head><title>Admin Control Panel</title></head>
<body>
<?php
$query = "SELECT password FROM adminlogin WHERE username = $user";
$result = mysql_query($query);
while ($row = mysql_fetch_array($result)) {
$password_check = $row['pwd'];
}
if ($password === $password_check) {
echo "Login Successful!";
}
else {
echo "Login Failed";
}
?>
</body>
the error is the following:
Warning: Supplied argument is not a valid MySQL result resource in /usr/home/novazro/public_html/admin/admincp.php on line 12
Login Failed
if you want to see the script 'active'; here it is: http://www.novaz3ro.com/admin
the login is: beta
password: testing
thanx a lot guys ;-)