ahs10 Posted February 9, 2008 Share Posted February 9, 2008 so i have for results that i want to run the same code over. i can't figure out how to get a variable variable name to work in my while loop though. something to the effect of... $result1 = mysql_query($query1); $result2 = mysql_query($query2); $result3 = mysql_query($query3); $result4 = mysql_query($query4); for ($i = 1; $i < 5; $i++) { while ($row = mysql_fetch_array($result[$i])) { //here's my code to be repeated on each result, referring to $row and column names like $row['id'] } } what's wrong? Quote Link to comment Share on other sites More sharing options...
Barand Posted February 9, 2008 Share Posted February 9, 2008 try while ($row = mysql_fetch_array(${'result'.$i})) { Quote Link to comment Share on other sites More sharing options...
ahs10 Posted February 10, 2008 Author Share Posted February 10, 2008 rock on, thanks. it makes so much sense when you see the answer...... Quote Link to comment 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.