mySQL Error?

admin

Administrator
Staff member
Hi,

I've created a script that allows me to simply read and update my database (mySQL). Unfortunatly, I get this error below and I can't figure out what's wrong...

Warning: Supplied argument is not a valid MySQL result resource in /usr/home/h/p/hphogw/public_html/testscript.php on line 22

Here's the code on line 18-22:
$db = mysql_connect($dbhost,$dbuser,$dbpass);
if (!$db){echo ("ERROR: " . mysql_error() . "\n");
$result = mysql_query("SELECT * FROM teachers WHERE teachername=$username AND teacherpass=$password",$db);
if (!$result){echo ("ERROR: Username or Password is invalid!\n");}
if ($myrow = mysql_fetch_array($result)) {

Thanks for your time!

- Matt
 
Back
Top