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]
I'm trying to loop through some rows I've grabbed from the database and throw them into a multidimensional array. I'm having trouble figuring out how to do it. Below is what I have right now, but it is only saving the last row of information because "$b" doesn't work as an incremental variable. It just keeps overwriting. If anyone knows of a different way to do it, or how to fix my process please let me know! THX for looking.
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 skyrise85 on Fri Feb 23, 2007 7:01 pm, edited 2 times in total.
Thanks for the reply. Your solution seems to work. However it is extremely slow. Do you have any idea why? Also how do you access an element of the resulting array? For instance "ItemId" below.
skyrise85 wrote:Thanks for the reply. Your solution seems to work. However it is extremely slow. Do you have any idea why?
My guess is that your DB query is not optimised. Print your $queryBox variable and paste it in phpMyAdmin and see what time it reports.
Also, the query may be good enough, but you are not LIMIT-ing the number of results and get a huge amount of rows.
skyrise85 wrote:Thank you. For that to work it is forcing me to store in a variable before I echo. Is there anyway to skip storing and go straight to echo?
It doesn't matter, it is temporary, only for testing. Of course you'll delete/comment the echo line afterwards.