Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in login.php on line 5
<?php
$db=mysql_connect("undisclosed", "atcommm_admin", "undisclosed");
mysql_select_db("atcommm_users");
$result=mysql_query("SELECT * FROM users WHERE uname=$username",$db);
$dbrow=mysql_fetch_array($result);
if($password==$dbrow["pword"]){
if($dbrow["type"]=='c'){$utype="Customer";}
if($dbrow["type"]=='a'){$utype="Administrator";}
if($dbrow["type"]=='m'){$utype="Manager";}
if($dbrow["type"]=='p'){$utype="Principal";}
if($dbrow["type"]=='s'){$utype="Sales";}
printf("id: %s<br>Username: %s<br>Type: $utype<br>Name: %s %s<br>Email: <a href=mailto:%s>%s</a><br>Company: %s<br>Title: %s<br><br>%s<br>%s, %s %s", $dbrow["id"],$dbrow["uname"],$dbrow["fname"],$dbrow["lname"],$dbrow["email"],$dbrow["email"],$dbrow["company"],$dbrow["title"],$dbrow["address"],$dbrow["city"],$dbrow["state"],$dbrow["zip"]);
}
else{
echo "<font style='font:bold 12 arial;color:red'>The username and/or password you entered was invalid.<br>Please re-enter your username and password.</font>";
echo "<form name=login method=post action=login.php style=margin-top:10>";
echo "<table width=258>";
echo "<tr><td style='font:bold 12 arial'><u>U</u>sername:<td colspan=3><input type=text name=username accesskey=u style='border:solid 2 #42454C;width:150;font:12 arial'>";
echo "<tr><td style='font:bold 12 arial'><u>P</u>assword:<td colspan=3><input type=password name=password accesskey=p style='border:solid 2 #42454C;width:150;font:12 arial' #293A65>";
echo "<tr><td style='font:12 arial' colspan=3 width=100%><input type=checkbox accesskey=r name=remember> <u>R</u>emember me<td align=right><img src=btns/reset.jpg style=margin-top:5 onclick=login.reset();login.username.focus()><input type=image src=btns/login.jpg style=margin-top:5 default>";
echo "</table></form>";
}
?>
Thanks for your help,
Chris.