Thanks all for the responses.. the solution was to add single quotes around the $Location variable.
> -----Original Message----- > From: Rick Emery [mailto:[EMAIL PROTECTED]] > Sent: Thursday, January 23, 2003 10:10 AM > To: Bryan Brannigan; Php List (E-mail) > Subject: Re: [PHP] mysql_fetch_row problem > > > I'm gong to bet that $Location is alpha, not numeric. Therefore: > $result = mysql_query("SELECT contactemail FROM loc WHERE > location=\"$Location\"",$db); > ----- Original Message ----- > From: "Bryan Brannigan" <[EMAIL PROTECTED]> > To: "Php List (E-mail)" <[EMAIL PROTECTED]> > Sent: Thursday, January 23, 2003 8:03 AM > Subject: [PHP] mysql_fetch_row problem > > > 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,c > ounter,insides > upport,am,receiving,shipping,purchasing,management,approval,un > iqueid) VALUES > ('$Name','$Location','$Position','$Emailaccess','$workathome', > '$citrix','$ti > mberline','$sawmill','$countersales','$insidesales','$accountm > anager','$rece > iving','$shipping','$purchasing','$management','Waiting','$uni > queid')"; > $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 > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php