PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hello folks!
I´m a beginner at this php stuff programming. Could anyone explain me why this variable $z at second loop never change? $z = 0 forever at the second loop, but at the first $z works fine...
Why php don´t allow you to use a variable outside of the loop?
Thank you guys!
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Last edited by dougsm on Mon Apr 24, 2006 7:56 pm, edited 1 time in total.
But the second loop will run every time the first loop runs, won´t it? I mean, no matter how many times the second loop runs, but the first should runs about 6 times I think. And every time the first runs, the second should be altered too...
Sorry if I´m wrong, I just can´t figure out the problem...
The inner loop will attempt to run as many times as the outer loop runs, however after the first run, mysql_fetch_assoc() will return false, thus stopping the code from running the inner loop.
Oh I see, do you have any suggestion? I´m trying to get the information checking the idTipo (a kind of class), want to display 2 of each idTipo from a giant array. The array is something like this: