Can someone tell me what I'm doing wrong with the following code. What I am trying to do with this is insert some data from a form into a database. Then I am querying another database to retrieve the email addresses related to $location. This is the error I get:
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in D:\inetpub\webroot\usrmgr\upd.php on line 15 This is the problematic code: $db = mysql_connect("localhost", "webapp"); mysql_select_db("usermgr",$db); $sql = "INSERT INTO usernames (name,location,position,email,home,citrix,timberline,sawmill,counter,insides upport,am,receiving,shipping,purchasing,management,approval,uniqueid) VALUES ('$Name','$Location','$Position','$Emailaccess','$workathome','$citrix','$ti mberline','$sawmill','$countersales','$insidesales','$accountmanager','$rece iving','$shipping','$purchasing','$management','Waiting','$uniqueid')"; $result = mysql_query($sql); mysql_close($db); $db = mysql_connect("localhost", "webapp"); mysql_select_db("helpdesk",$db); $result = mysql_query("SELECT contactemail FROM loc WHERE location=$Location",$db); while($row = mysql_fetch_row($result)){ $contactemail = $row[0]; } Thanks in advance, Bryan ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "90% of being smart is knowing what you're dumb at." Bryan Brannigan Hancock Lumber System Administrator Information Technology (v)207.627.7694 (f)207.627.7041 [EMAIL PROTECTED] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php