I am a little confused about what I am doing.
I am using CodeIgniter. I want to fetch user profile information from the server. I set a user_id in session variable userId
after successful login and write a query to fetch all user info in the Model:-
Type 1
$this->db->where('user_id',$this->session->userdata('userId'));
$res = $this->db->get('user_info');
Suppose 100 users are accessing their profile information at the same time.
How does the web server maintain each user request in the above scenario because models are obviously executing on the server and there are multiple sessions running at the same time.
Should I pass session variable 'userId' data in the URL, so my query will be
Type 2
$this->db->where('user_id',$this->uri->segment(3));
$res = $this->db->get('user_info');
Which is a better coding practice to get user profile information from server when 100s or 1000s of users are accessing the server at the same time, Type 1 or Type 2?