After login -> then it displays his personal data taken from mysql db

hello Sitepoint members =)


Mr Bob has login into my website. I use PHP sessions for the login application.

The Question

How to display only “Mr Bob’s” personal data such as name, email, address
and etc from the mysql ?

and how to allow him to delete or edit those data ?


I am using PHP sessions… so something like select from table “bob” is not gonna work for me… i need to know how to pass the data from the login form into the mysql database… to allow bob to view, edit and delete his own table.

Thanks for all the advice given.

At the point the user logs in, put his username in the session. Then you select from the table the rows for that username. If his username is “bob”, then select from table “bob” works just fine!

$sql = "SELECT name, email FROM users WHERE username = '" . $_SESSION['username'] . "'";
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
echo "Hello, " . $row['name'] . " (" . $row['email'] . ").";

wow, thats the perfect solution I needed.

A BIG THANK you my friend.
God bless you

1 Like