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
https://forums.phpfreaks.com/topic/121596-session-and-mysql-variable-question/
Share on other sites

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.