JSHINER Posted May 3, 2007 Share Posted May 3, 2007 I am wondering how using the following: while($row = mysql_fetch_array($result)){ echo $row['STUFF']; } How could create another query within EACH result so I could run a query based on $row['STUFF']. Because I have two databases, one which contains the $row['STUFF'] and another that contains what I am looking for. So lets say I want the name of a person that matches $row['STUFF'] - How can I go about doing this? Link to comment https://forums.phpfreaks.com/topic/49814-help-with-a-query/ Share on other sites More sharing options...
thedarkwinter Posted May 3, 2007 Share Posted May 3, 2007 Hi <?php mysql_select_db("db1"); $result = mysql_query("SELECT...."); while ($row = mysql_fetch_array($result)) { $stuff = $row['STUFF']; mysql_select_db("db2"); $result2 = mysql_query("SELECT .. WHERE stuff='$stuff';"); while ($row2 = mysql_fetch_array($result2)) { echo $row2['FOOBAR']; } } Should work like, i think Cheers, tdw Link to comment https://forums.phpfreaks.com/topic/49814-help-with-a-query/#findComment-244338 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.