I was wondering if using $_SESSION[‘data’] would be a smart way to hold information about a user who is logged in.
For example:
Say i have a game and i want to display their level/exp/username etc, well currently every page load i have to recall the database… so im wondering if i store it in a SESSION i can use a boolean to tell PHP if it needs to re-update its data… thus reducing the amount of MYSQL calls ?
Is this a smart idea of is there some flaw im unaware of ?
what about competition between database updates? How would you know if the data is not up to date anymore? If this is a straightforward and reserved data to the logged user, allowing him to be logged in only once at a given time, then why not 🙂
If you seek an alternative, there’s this new thing of local storage, by HTML5
http://diveintohtml5.info/storage.html