PHP MySQL Display Table Data Help?

  • Thread starter Thread starter red scar
  • Start date Start date
R

red scar

Guest
$myDB = new mysqli('localhost', 'root', 'password', 'user_data');
$statement_ = "SELECT * FROM user_data WHERE specific_user=".$UniqueUser;
$res = $myDB->query($statement);

// ... etc.. etc..

The first answer is absolutely correct. This answer will serve as your alternative guide and example.

* remember that $UniqueUser is a variable and contains value of the specific user..
 
I have a table named "user_data" where certain information about the users is kept. I need a way, after the user has logged in, to display ONLY the information pertaining to that specific user, in a table, without any other user’s info. I already have the registration and login scripts, I just need the display script. Any ideas on how to do this?
 
$myDB = new mysqli('localhost', 'root', 'password', 'user_data');
$statement_ = "SELECT * FROM user_data WHERE specific_user=".$UniqueUser;
$res = $myDB->query($statement);

// ... etc.. etc..

The first answer is absolutely correct. This answer will serve as your alternative guide and example.

* remember that $UniqueUser is a variable and contains value of the specific user..
 
So...you want the user's to be able to see their own information?

Tell PHP, when it does a MySQL query to search the table but only take row values where the user name is involved.

e.g.

Bob logs in

$query='select * from user_data where last_name = "Bob" ';

Of course..you'll probably have more than one Bob but you get the idea. You can do searches to identify them by their unique ID or whatever you want.
 
Back
Top