Re: Whats the correct syntax for using query results in a new query

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>
> I'm trying to use the AdminID that returns from query #1 in the WHERE
> AdminID = AdminID from Query 1


Okay, I think I understand what you are trying to do.

//query 1
$query1 =  "SELECT UserName, AdminID FROM admin
     WHERE   Retail1 =  'YES'";

$result1 = mysql_query ($query1) ;
while ($row1 = mysql_fetch_row($result1)){

$admin_id = $row1['AdminID'];

//query 2
$query2= "SELECT WorkOrderID, CreatedDate, Location, WorkOrderName,
AdminID, FormName, Status, Notes, pod FROM workorders WHERE AdminID =
$admin_id";

$result2 = mysql_query ($query2) ;
$end_result = mysql_fetch_row($result2);
echo $end_result['WorkOrderID'];
echo $end_result['CreatedDate'];

}

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux