0

What I'm trying to do is select data from a specific row only in a MySQL database with PHP. For example, lets say if USER1 is logged in, I want to grab that users data from the row in the database and display it on USER1's profile with PHP. How can I do this with PHP? Please help me as I'm new to MySQL!

1

2 Answers 2

1

This should work for what you need.

$result = mysql_query("SELECT * FROM Persons WHERE user ='$user1'");

while($row = mysql_fetch_array($result))
  {
  echo $row['FirstName'] . " " . $row['LastName'];
  echo "<br />";
  }
Sign up to request clarification or add additional context in comments.

Comments

0

look this tutorials:

http://www.homeandlearn.co.uk/php/php13p2.html

http://php.about.com/od/phpwithmysql/ss/mysql_php_2.htm

Comments

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.