storing and using results from a query on another query
Posted: Thu Oct 01, 2009 3:36 pm
Hi Guys,
I am having some troubles with this script. The goal is to get a unique ID from one table, store it as a array, then with another query update a second table using information from the first table all related to that first array created on the first query.
I am getting "Parse error: syntax error, unexpected T_STRING" on the first line of the second query.
I am pretty new at this.... so please forgive any stupid mistakes or complete misunderstandings.
Thanks,
P
Also, if I echo the $row... All I see is "Array." Is that correct?
I am having some troubles with this script. The goal is to get a unique ID from one table, store it as a array, then with another query update a second table using information from the first table all related to that first array created on the first query.
I am getting "Parse error: syntax error, unexpected T_STRING" on the first line of the second query.
I am pretty new at this.... so please forgive any stupid mistakes or complete misunderstandings.
Thanks,
P
Code: Select all
<?
include "db.php";
$uid = $_GET['uid'];
$request = $_GET['req'];
$requid = $_GET['requid'];
$getresp = "SELECT resp_uid FROM requests WHERE request = '$req'";
$result = mysql_query($getresp) or die(mysql_error());
$row = mysql_fetch_array($result) or die(mysql_error());
$accept = "UPDATE requests2 SET `status` = '$status', `resp_name` = (SELECT `name` FROM `users` WHERE `uid` = '.$row'), `resp_organization` = (SELECT `organization` FROM `users` WHERE `uid` = '.$row'), `resp_email` = (SELECT `email` FROM `users` WHERE `uid` = '.$row'), `resp_phone` = (SELECT `phone` FROM `users` WHERE `uid` = '.$row'), `resp_url` (SELECT `email` FROM `users` WHERE `uid` = '.$row'), `resp_im` = (SELECT `im` FROM users WHERE `uid` = '.$row'), `resp_address` = (SELECT `address` FROM `users` WHERE `uid` = '.$row')";
$acceptresult = mysql_query($accept) or die(mysql_error());
?>