![]() |
Nested While Loop Issue
I'm having trouble with nested while loops.
Here's what I am currently doing. PHP Code:
PHP Code:
|
Because it only has one result set to work with. If you need it to run the loop on that second query each time the first loop runs, you need to nest the query inside the first loop so that $nation_list will repopulate itself each time - alternatively, and better yet, as it only runs the query once, you could run the nested loop outside of the first loop and save the results to a variable, then just echo that variable inside the first loop each time. Ala;
PHP Code:
|
Thanks m,
I'm getting this error now. Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource on line 31 Which is this line, PHP Code:
Actually got it fixed by changing it to PHP Code:
It's working great now. Thanks! |
ahahah oops, I didn't realize I reused the same variable there. That's why I use hungarian notation, but I try to omit it in examples for people who don't use it.
-m |
| All times are GMT. The time now is 11:07 AM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0