rbragg Posted April 17, 2007 Share Posted April 17, 2007 I have some results to a query called $firstResults and a while loop to display those results: <?php while($row = mysql_fetch_array($firstResults)) { blah blah blah } ?> This works fine. However, I would like to use the results of another query and display those within the above loop. Is this possible? Here is my second query: <?php $queryLast = " SELECT MAX(actionID), name, subjectID, subject, msg, timestamp FROM onetable GROUP by subjectID ORDER by timestamp DESC "; $lastResults = mysql_query($queryLast) or die('This last query failed: ' . mysql_error()); ?> Quote Link to comment https://forums.phpfreaks.com/topic/47444-solved-using-a-query-inside-of-mysql_fetch_array-while-loop/ Share on other sites More sharing options...
artacus Posted April 17, 2007 Share Posted April 17, 2007 Sure it is. Just use different variables to store mysql_query() and mysql_fetch_array() values. Quote Link to comment https://forums.phpfreaks.com/topic/47444-solved-using-a-query-inside-of-mysql_fetch_array-while-loop/#findComment-231491 Share on other sites More sharing options...
rbragg Posted April 17, 2007 Author Share Posted April 17, 2007 Thanks for your reply. Wouldn't this require having a while loop INSIDE of another while loop? Quote Link to comment https://forums.phpfreaks.com/topic/47444-solved-using-a-query-inside-of-mysql_fetch_array-while-loop/#findComment-231506 Share on other sites More sharing options...
rbragg Posted April 17, 2007 Author Share Posted April 17, 2007 Thanks again - I figured it out. Quote Link to comment https://forums.phpfreaks.com/topic/47444-solved-using-a-query-inside-of-mysql_fetch_array-while-loop/#findComment-231569 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.