hi for all the expert here, i am now facing a minor problem on retrieving data here. MySQL do contain all the variables defined with data inside it. However, i juz need to know how to loop through the array to get all the data in a row?
Below is the php code i used:
<?php
mysql_connect("localhost", "root", "1234") or die(mysql_error());
mysql_select_db("userlist") or die(mysql_error());
//session_start();
$query = "SELECT * FROM user";
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result) or die(mysql_error());
if($_POST['name'] == $row['username'])
{
echo "Thanks for logging in.";
header("http://www.google.com");
}
else
{
echo "Sorry, your username and password does not match.";
//header("http://www.yahoo.com");
}
$_SESSION['name']=$_POST['name'];
$_SESSION['password']=$_POST['password'];
$_SESSION['status']=$_POST['status'];
?>
especially at the function, i dunnoe why i can see the Thanks for login even no username entered. Can anyone help? By the way, php redirect cannot use more than once? Thanks for help....