select firstname, lastname
where email=$email and password=$password
$_SESSION['userdata'] = $u_data;
I may have it wrong, but I think OP is tracking sessions in a DB table - possibly to support multiple front ends, such as for load balancing. Then again, I may have misread it and s/he really is looking for your answer :)
If you get a result row, you know it's a valid login, and then you just retrieve the name data. I have no idea how your db class works, but it shouldn't be too hard to get it to do that.
It'd be as simple as doing something like:
When user registers and is automatically logged on, first_name, last_name etc are put into my sessions table in the db. This is because the post data is available from when user fills out the registration form. With login now the only fields available are email and password so the only post data I can grab to put into my sessions table would be email. So that's where I became stuck.
gotcha. So, you simply modify you class to fetch that information from the DB once the login's authenticated. I don't know how your DB class works, but instead of merely checking if there's a matching row, fetch the first/last name, using a query something like this:
within your CheckLogin method. The session is just a regular PHP array that happens to be automatically preserved for you. You can put anything you want into it, but you do have do put things into it yourself - PHP won't do it for you.