0

DB User Data

I can get data just from user_name and user_email and user_id after login page using this following code:

echo  $_SESSION['user_name'] . "<br />";
echo  $_SESSION['user_email'] . "<br />";

but I can't get other user data like user_familyname and user_firstname.

For Exmpale:

echo  $_SESSION['user_firstname'] . "<br />";
echo  $_SESSION['user_familyname'] . "<br />";

There is no display at all for these two above codes.

Could you please help me how can I display for specific user information after login page?

Really Thank you for any help and guide.

Regards

2
  • 1
    You're probably not setting those sessions... show us how you set user_name and user_email. Commented Jan 13, 2015 at 16:52
  • behdasht.co/websites/classes/registration.txt Here is my registration page , how set to these users Commented Jan 13, 2015 at 17:00

1 Answer 1

1

You'll have to set those sessions too, just like how you set $_SESSION['user_name'] and $_SESSION['user_email'].

When you retrieve fields from your database, they won't get magically set into your session variables!
You'll have to do that yourself.

Sign up to request clarification or add additional context in comments.

6 Comments

Could you please tell me how to do it? Cause I checked all my codes, everything is ok, except these two fields. however I've set all correct, even registration page and email verification and all are working well except fetching these two fields data ..
Doesn't seem like your session is getting set on the page that you send, are there any other pages?
Show me the login, thats where the session is set probably :)
behdasht.co/websites/classes/login.txt Please check the login page here. Thank you
As i look at it everything seems to be fine, sessions are getting set as it seems. can you do a var_dump($_SESSION); on your index after logging in?, that way you can see if they are getting set or not.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.