Jump to content

session and mysql variable question.


daydreamer

Recommended Posts

Hi,

 

I am going to use a mysql database, and on one of my pages i need to display a number.

 

It is very important that this number stays accurate. it decease's when users use credits, and when user's top up their account it goes up!

 

anyway, when the user logs in I will use session_start(); , use SQL to get the number from the database and store it in a $_SESSION['current'];

 

Is it best to get that same number from the database every time, or just when they login, then update the database when they log out.

 

Problem is if they logout without running the logout script (ie closing the browser) how will my PHP script know when to update the database?

 

Also I want to keep the site as fast as possible, which means minimum database querys, right?

 

Thanks!

 

 

 

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.