mysql_fetch_row problem
| From: | Bryan Brannigan | Date: | Thu, 23 Jan 2003 14:03:23 +0000 |
| Subject: | mysql_fetch_row problem | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-132830@lists.php.net to get a copy of this message | ||
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
bbrannigan@hancocklumber.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~