Re: looping rows
Posted: Sat Feb 18, 2012 6:43 am
I see you have a query inside of a WHILE loop. How many times do you think that loop is running each time the script runs? If it is like 3 or 4, you are probably fine, but too much more than that, and you would probably be putting a lot of stress on the DB to support a decent community.
Without comments in the code and a more clear image of what you need your code to do, I really can't break it down on how I would do it. All I can really do is scan for queries in loops, which is what I did, because those can get out of hand quick.
Without knowing more about exactly how your traveling system works, I would say working out a system to figure out what travel options are available from within PHP and then querying for them all at once may be a better system. But don't trash this since you have it working. Having a huge community is a dream for many of us, so just having something working and moving on can be more valuable than spending weeks tinkering with getting it "just right". You could always update it later if you build it modularly enough that you could just lift it out and drop in a different system then.
Without comments in the code and a more clear image of what you need your code to do, I really can't break it down on how I would do it. All I can really do is scan for queries in loops, which is what I did, because those can get out of hand quick.
Without knowing more about exactly how your traveling system works, I would say working out a system to figure out what travel options are available from within PHP and then querying for them all at once may be a better system. But don't trash this since you have it working. Having a huge community is a dream for many of us, so just having something working and moving on can be more valuable than spending weeks tinkering with getting it "just right". You could always update it later if you build it modularly enough that you could just lift it out and drop in a different system then.