Select id from table admin with PHP and MySQL

i need help with php code trying to retrieve all information from a table using the username that is logged in.

So here is a example:

Bob logs in with his username & password He then comes to a members only section In this section it displays his results from the admin table which will show: username & password

Hope this makes sence, I am using a session()

Answers


It is not that hard to accomplish. You basically had the answer in your comment.

<?php
 $query = "select * from table_name where username = '". $_SESSION['username'] . "'";
 $result = mysql_query($query);
 while($row = mysql_fetch_array($query)) {
  $password = $row['password']
 }
 // Then do your output of information
?>

I think the question needs to be clearer.

retrieving all information from a table could mean doing

<?php $result= mysql_query("select * from table_name;") ?>

Need Your Help

Loading an existing database into WWW SQL Designer?

sql mysql diagram

I've used WWW SQL Designer several times to design databases for applications. I'm now in charge of working on an application with a lot of tables (100+ mysql tables) and I would love to be able to...

PHP: dealing with quotes, escaping etc in string manipulation

php string escaping

I am making a certain class with complicated string manipulations.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.