Display logged in user, Display custom table based on user logged in?

Hello!
I am totally new to PHP. I have been able to let users log in etc. through dreamweaver and a mysql database!
I am just looking for some help to display the user who is logged in in the corner of the webpage. is there a simple php code to do this?

secondly I am looking for a way to display a custom table for the specific user who is logged in. The data in the table is retrieved from my mysql database. just like something webshops have, the “View orders”.
I hope you understand what i am trying to explain :slight_smile:

Many Thanks!

It can be helpful to display username after login …in the left hand side…
?php

session_start();

if ($_SESSION[‘username’])
echo “

Welcome, “.$_SESSION[‘username’].” !

Logout

”;
else
die("You must be logged in ");
?>

Yes, Lob, you can do this many ways, but, we would need to know some of your code to help you.
Anything can be pulled from a database and displayed. You just have to query the database correctly.
For instance, if you have a table in your database full of “orders”, they have a field in the table for which
user placed the order. So, then you would query something like:
"SELECT * FROM orders WHERE username=‘someuser’ "

Then, display the data in the results. You will need to give more details on your current system and what
you need help about. Good luck…

Sponsor our Newsletter | Privacy Policy | Terms of Service