Re: Using results for next query

From: Date: Mon, 08 Mar 2004 09:46:56 +0000
Subject: Re: Using results for next query
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-33360@lists.php.net to get a copy of this message
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


« previous php.db (#33360) next »