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..

Link to comment
Share on other sites

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..?

Link to comment
Share on other sites

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

 

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.