Quote:
Originally Posted by ssonawa
Do you want to use $_SESSION['user_id'] (which is saved in your above code) to query to a different table? If yes then you can simply us it in a query as below -
$query_getName_1 = sprintf("SELECT user_id, address FROM users_address WHERE user_id= $_SESSION['user_id']" );
Let me know if you have other issue.
Cheers,
Ssonawa
|
Thanks. What I want to achieve is when John logged in his username will be assigned with this variable
PHP Code:
$_SESSION['MM_Username'] = $loginUsername;
and I can fetch data from the user_table. that has John's user_id, username, First Name, Last Name.
But I cannot figure out how to fetch data from another table that has John's user_id as foreign key.
If John logged in he will see his personal details and when Tom logged in Tom will see his personal details.
TIA