daydreamer Posted August 27, 2008 Share Posted August 27, 2008 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 More sharing options...
pocobueno1388 Posted August 27, 2008 Share Posted August 27, 2008 You need to grab/manipulate that number from the database each time. Going with sessions isn't going to work, and you already stated the problem, and there is no way around that. Link to comment https://forums.phpfreaks.com/topic/121596-session-and-mysql-variable-question/#findComment-627187 Share on other sites More sharing options...
daydreamer Posted August 27, 2008 Author Share Posted August 27, 2008 ok cheers Link to comment https://forums.phpfreaks.com/topic/121596-session-and-mysql-variable-question/#findComment-627243 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.