take one row from database and print

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
hakiki_dolphin
Forum Newbie
Posts: 9
Joined: Thu Jan 30, 2003 3:00 pm

take one row from database and print

Post by hakiki_dolphin »

Hi,
I want to make an authentication page. I made a database that consists of a table of 12 variables. First variable is username, and the second is password. In the login page I want the two variables from the user, and if the variables match with my table, the message is "successfull" and the other variables of the row will be written (for only the matched username and password's row) in the login.php. If the username and password aren't in the table the message is "try again" in the login.php.
I solved the authentication problem but I can't print the variables of one row that include entered username and password. I send you my code and database. The problem is in login.php page.
If you could help me, I will be very happy.
Regards.
Ahmet Kara
bionicdonkey
Forum Contributor
Posts: 132
Joined: Fri Jan 31, 2003 2:28 am
Location: Sydney, Australia
Contact:

Post by bionicdonkey »

this should work...

$query = mysql_query("SELECT * FROM db WHERE username='$username' AND password='$password'");
$row = mysql_fetch_array($query);

// the fields are the array elements...e.g $row['field'];

echo $row['field'];
// just keep echoing required fields
Post Reply