Page 1 of 1
Best Way to Call Data From MySql Table
Posted: Fri Aug 19, 2011 2:26 pm
by joevis
Hey I'm building a website that accesses a mysql database and grabs data from hundreds of tables to display on various pages.
What would be the best way to call the data I need to display on each page? Would it be better to simply call everything once and dump it into $_SESSION or access the database on each page and grab the info from the results array?
Re: Best Way to Call Data From MySql Table
Posted: Fri Aug 19, 2011 2:40 pm
by social_experiment
joevis wrote:...grabs data from hundreds of tables to display on various pages.
From this i gather you retrieve the information from other tables, do you store it in a database of your own?
joevis wrote:What would be the best way to call the data I need to display on each page? Would it be better to simply call everything once and dump it into $_SESSION or access the database on each page and grab the info from the results array?
If you store the information in your own database (or if it's stored in another database) it would be quicker (imo) to retrieve it as needed. Storing it in a session variable means you still have to access the database before you store it and then that information is displayed to the user on the requested page (from the variable). Cut out the middle variable so to speak.
Re: Best Way to Call Data From MySql Table
Posted: Fri Aug 19, 2011 2:59 pm
by kasuals
If you store the information in your own database (or if it's stored in another database) it would be quicker (imo) to retrieve it as needed.
Quoted for (imo) truth.
I would assume the time it takes (traffic aside) to read in a query from a database even with a large table is less consuming than setting session variables, and retrieving them. The code is probably easier to read too. Sessions are saved on the server side, so it's still being queried.
Then again, assumption is for the ignorant I assume. (harhar)
Re: Best Way to Call Data From MySql Table
Posted: Fri Aug 19, 2011 3:52 pm
by joevis
Awesome, thanks!