my code doesnt work, please help
Posted: Tue Jul 13, 2010 4:04 am
<?php
$user = $_GET['usid'];
$code = $_GET['pass'];
$date = date("D M d, Y");
$time = date("G:i a");
if (Login is clicked)
{
$con = mysql_connect("localhost");
if (!$con)
{
die('CONNECTION UNAVAILABLE ' . mysql_error());
}
else
{
mysql_select_db("Attendance", $con);
$pass = mysql_query("Select PW FROM Employees
WHERE EmpID == $user");
if ( $pass == $code )
{
mysql_query("INSERT INTO Attendance (CDate, TimeIn)
VALUES ($date, $time)
WHERE (Id==$user && pass==$code);
echo "You have logged in as: " . $user . " at " . date("D M d, Y G:i a");
mysql_close($con);
}
else
{
echo "Wrong password or username, try again."
}
else
{
$con = mysql_connect("localhost");
if (!$con)
{
die('CONNECTION UNAVAILABLE ' . mysql_error());
}
else
{
mysql_select_db("Attendance", $con);
$pass = mysql_query("Select PW FROM Employees
WHERE EmpID == $user");
if ( $pass == $code )
{
mysql_query("INSERT INTO Attendance (CDate, TimeOut)
VALUES ($date $time)")
WHERE (Id==$user && pass==$code);
echo "You have logged out at " . date("D M d, Y G:i a");
mysql_close($con);
}
else
{
echo "Wrong password or username, try again."
}
}
?>
This is my code, im trying to input the login time of a user when he clicks on the login button, and to input the logout time when he logs off. it's not working please help
$user = $_GET['usid'];
$code = $_GET['pass'];
$date = date("D M d, Y");
$time = date("G:i a");
if (Login is clicked)
{
$con = mysql_connect("localhost");
if (!$con)
{
die('CONNECTION UNAVAILABLE ' . mysql_error());
}
else
{
mysql_select_db("Attendance", $con);
$pass = mysql_query("Select PW FROM Employees
WHERE EmpID == $user");
if ( $pass == $code )
{
mysql_query("INSERT INTO Attendance (CDate, TimeIn)
VALUES ($date, $time)
WHERE (Id==$user && pass==$code);
echo "You have logged in as: " . $user . " at " . date("D M d, Y G:i a");
mysql_close($con);
}
else
{
echo "Wrong password or username, try again."
}
else
{
$con = mysql_connect("localhost");
if (!$con)
{
die('CONNECTION UNAVAILABLE ' . mysql_error());
}
else
{
mysql_select_db("Attendance", $con);
$pass = mysql_query("Select PW FROM Employees
WHERE EmpID == $user");
if ( $pass == $code )
{
mysql_query("INSERT INTO Attendance (CDate, TimeOut)
VALUES ($date $time)")
WHERE (Id==$user && pass==$code);
echo "You have logged out at " . date("D M d, Y G:i a");
mysql_close($con);
}
else
{
echo "Wrong password or username, try again."
}
}
?>
This is my code, im trying to input the login time of a user when he clicks on the login button, and to input the logout time when he logs off. it's not working please help