Re: Using results for next query

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

 



Hi Shannon

you need to do something like

$sql = "SELECT user_id FROM table WHERE ......";
$res = mysql_query($sql) or die(mysql_error());
while ($uids = mysql_fetch_array($res))
{
$sql2 = "SELECT something FROM another_table WHERE user_id = $uids[0]";
......
whatever else you need to do .......
}


hth

steve



Shannon wrote:


Hi People,


Am needing a little help on the following scenario.

Selecting user_id from one table for all entries that match the required
criteria.

Now I want to use the user_id's that are returned by the previous query in
another to obtain more information from another table.


Basically using the results of one query to become the critera for another
query and do this for all the responses from the first query.

Any assistance would be greatly appreciated.

Cheers,

Shannon






-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux