PHP help!!!!!!!!!!!!1?

Awesomedude

New member
It's supposed to verify the username and password against the database. but somehow there's something wrong and i couldn't figure it out. Please help!!!

<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Welcome Screen</title>
</head>

<body>
<?php
define( "DATABASE_SERVER", "localhost" ); //MySQL Server location usually localhost
define( "DATABASE_USERNAME", "root" ); //MySQL Username
define( "DATABASE_PASSWORD", "" ); //MySQL Password
define( "DATABASE_NAME", "loginsystem" ); //Database that should be used
//connect to the database
$mysql = mysql_connect(DATABASE_SERVER, DATABASE_USERNAME, DATABASE_PASSWORD) or die(mysql_error());
//select the database
mysql_select_db( DATABASE_NAME );

//assign the data passed from login.html
$username=$_POST["username"];
$password=$_POST["password"];

$query = "SELECT username FROM users WHERE userid = '$username' AND userpassword = '$password'";
$result = mysql_fetch_array(mysql_query($query));
if(!$result)
{
print("Login is invalid");
}
else
{
print(mysql_result(mysql_query($query), 0));
$query = "UPDATE users SET lastloggedin=current_timestamp WHERE userid = '$username' AND userpassword = '$password'";
mysql_query($query);
}
?>

</body>
It's supposed to say:
print(mysql_result(mysql_query($query), 0));

I don't know why Yahoo answers made it ...0));
Again....

change [3 dots] )); to [comma][space][space] 0));
 
Back
Top