Jump to content

loop help


MDanz

Recommended Posts

i've been doing while loops for this problem .. i dont think its the right way though.

 

i have a set of boxes each with a boxid(apart from the first), which is the id(mysql) of the previous box. 

 

e.g.

box 1 has id 1

box 2 has id 2 and boxid 1,

box 3 has id 3 and boxid 2 etc

 

you see the boxid is the same as the previous id.

 

i want 10 boxes to display , when i'm trying to loop this i am using a while loop, but i keep on having to use another while loop inside, just to match the boxid with previous id, to get the next box to display. so i would have to do 10 while loops inside one another, which isn't good practice.

 

is there a better way to do this? for loop? 

 

another example

 

e.g.

box 1 has id 239

box 2 has id 456 and boxid 239,

box 3 has id 123 and boxid 456 etc

 

Link to comment
https://forums.phpfreaks.com/topic/228756-loop-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.