Jump to content

Query Mysql Database once and retain information


CMNetworx

Recommended Posts

I want to have my menu buttons loaded out of my mysql database, so I can edit them quickly in a login panel..

 

What I am wondering is, I figure there would be alot of stress on the database if every time someone visits any page it does a query to figure out the menu buttons..

 

Is there a way to easily retain this information so the query can be done once, and not per page?

 

I suppose this would be a session, but is there any other way? or a more efficient way? or are sessions the best?

 

Thanks for any help..

I will probably just throw it into a session..

 

The answer kinda hit me as I was typing the question, but I still felt compelled to ask..

 

Another quick question, Is there any way to have multiple sessions running at the same time?

 

like one session that starts to create and retain the set of buttons,

then later another session starts as the user logs in to their panel, and it holds their name, etc..

 

Would the sessions just blend together? or raise hell..?

Sessions are just like any other array you can hold the page info in one session array

$_SESSION['page']

so upload button can be

$_SESSION['page']['upload'] = "link to upload page";

$_SESSION['page']['download'] = "link to download page";

 

and when the user logs in hold their data in another session array

$_SESSION['user']['username'] = "username";

 

 

And so on

 

Ray

 

 

 

 

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.