Can figure out what is wrong. Keep getting this error: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource... on line 12. I'll test the code in order of the replies, and first correct person gets the credits. Here is the code:
PHP:
<?
include("connection.php");
$username=trim($username);
$password=trim($lpassword);
if($username=="" || $password =="")
{
header("Location: index.php?error=wu");
exit;
}
$sql="SELECT 'password' FROM 'admin' WHERE 'username'='$username'";
$result=mysql_query($sql);
while($row=mysql_fetch_array($result))
{
$dbpass=$row[0];
}
if($dbpass==$password)
{
session_start();
$admin_username=$username;
session_register("admin_username");
}
else
{
$myFile = "index.php?error=wu";
$fh = fopen($myFile, 'w');
exit;
}
?>