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!
It is a bit server intensive, a join is quicker but do you think you can easily get information in the query result from the join displayed in the way you want...I think then you would be delegating work to the Web server instead of database server...
I think for just listing, it is better to use single select statements inside loops instead of joins. If anybody has got a better way to handle this result easily then I would be eager to hear from it you...
i think what he is doing is faster then the join query... the join query will affect more the database server... and what he have with the select query and whiles, will use both server and database capacity... and will work faster... i didn't test....
the OP's is very likely not faster. This is due to running n 1 queries where n is the number of records that would match.
There are two possible routes to make it faster, one is raghavan20's. The other is running two queries and making the connections yourself after the fact, or using a mild amount of preprocessing.
I had done a lot of the loading query results into arrays, and referencing them later on in the script to avoid using queries inside of loops.
However, on a few scripts I am loading 4 or 5 separate arrays which I think is using up more memory than it should. I think I should look into using joins.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
or only do the queries when you need them, and instead of loading them into arrays, loop over the result as you need it and use mysql_free_result() as soon as possible in the script