Hello
i wrote script to update my database but each time I run it I always have this error message:
Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in d:\phpweb\admin_system\updatestaff.php on line 40
I dont know whats wrong Please help. Here's my script
<html>
<head>
<title>Staff update GUI</title>
</head>
<body><h1>Database Staff update Result</h1></body>
<?php
//Create short variable names. (REGISTER_$GLOBALS = OFF)
$StaffN = $HTTP_POST_VARS['StaffN'];
$Name = $HTTP_POST_VARS['Name'];
$Sex = $HTTP_POST_VARS['Sex'];
$Post = $HTTP_POST_VARS['Post'];
$Username = $HTTP_POST_VARS['Username'];
$Password = $HTTP_POST_VARS['Password'];
$Auth = $HTTP_POST_VARS['Auth'];
if (!$StaffN || !$Name || !$Sex || !$Post || !$Username || !$Password || !$Auth)
{
echo 'ERROR: You have not completed all required fields.<br/>'
.'Please go back and try again.';
exit;
}
$StaffN = addslashes($StaffN);
$Name = addslashes($Name);
$Sex = addslashes($Sex);
$Post = addslashes($Post);
$Username = addslashes($Username);
$Password = addslashes($Password);
$Auth = addslashes($Auth);
$session = mysql_connect ("localhost", "root", "platinum");
if (!$session)
{
echo 'Error: Could not connect to the database. Please try again later.';
exit;
}
mysql_select_db("xplosive");
$query = "insert into staff values
('".$StaffN."', '".$Name."', '".$Sex"', '".$Post"', '".$Username"', '".$Password"', '".$Auth"')";
$result = mysql_query($query);
if ($result)
echo mysql_affected_rows().' The staff table was succesfully updated.';
?>
</body>
</html>
PLease help 🙁