What data should I store in a PHP session?
codeigniter, codeigniter-2, php, session
Solution
You should only keep temporary data in sessions that tracks that current user. Anything else should stay hidden in the database until it's needed.
Problem
I am building a small application that users can log into using CodeIgniter My question is, when a user logs in, is it advisable to store a lot of the users personal information in the session (like their user id, name, email and telephone number). Or should I try leave personal information out and just keep their user id in the session only? I don't want to have to make database queries constantly to get some or the users basic information. Update I will be using a database to store all their information, I just want to know when they log in, is it advisable to keep their data stored in a session as well as the database? Thanks