Whats the correct syntax for using query results in a new query
| From: | Terion Miller | Date: | Tue, 03 Mar 2009 20:09:04 +0000 |
| Subject: | Whats the correct syntax for using query results in a new query | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-289181@lists.php.net to get a copy of this message | ||
I'm trying to use the AdminID that returns from query #1 in the WHERE
AdminID = AdminID from Query 1
$sql= "SELECT WorkOrderID, CreatedDate, Location, WorkOrderName,
AdminID, FormName, Status, Notes, pod FROM
workorders WHERE AdminID =
'".$row['AdminID']."' ";
that isn't working and the query 1 does return in this case 3 AdminID's so
I'm thinking it's just the .$row['AdminID'] part that is wrong
and I have tried some different things but am not sure the correct term for
what I'm trying to do so I can' t seem to google answers....
Here is my query #1
$query = "SELECT UserName, AdminID FROM admin
WHERE Retail1 = 'YES' ";
$result = mysql_query ($query) ;
//$row = mysql_fetch_array($result);
while ($row = mysql_fetch_row($result)){
for ($i=0; $i<mysql_num_fields($result); $i++)
echo $row[$i] . " ";
}
Above returns 3 AdminID ... I also tried using the While statement in my
second query to return the sets but nothing... yet the code isn't breaking,
just returning 0
Thanks
Terion
Happy Freecycling
Free the List !!
www.freecycle.org
Over Moderation of Freecycle List Prevents Post Timeliness.
------------------------------------------------
Twitter?
http://twitter.com/terionmiller
------------------------------------------------
Facebook:
<a href="http://www.facebook.com/people/Terion-Miller/1542024891"
title="Terion Miller's Facebook profile" target=_TOP><img src="
http://badge.facebook.com/badge/1542024891.237.919247960.png"
border=0
alt="Terion Miller's Facebook profile"></a>
Joe DiMaggio - "Pair up in threes."