Mysql_real_escape_string () expects parameter 2 to BES resource, object given in
The code is as follows:
$page _title = ' Register ';
Include ("header.html"); #网页头部
?>
if (Isset ($_post[' submitted ')) {
Require_once ("mysqli_connect.php");
$error =array (); #定义错误为数组
if (Empty ($_post[' first_name ')) {
$error []= ' forgot to enter your first name ';
}else{
$FN = mysql_real_escape_string (Trim ($_post[' first_name '), $DBC);
} #first the name condition statement
if (Empty ($_post[' last_name ')) {
$error []= ' forgot to enter your last name ';
}else{
$LN = mysql_real_escape_string (Trim ($_post[' last_name '), $DBC);
} #last the name condition statement
if (Empty ($_post[' email ')) {
$error []= ' forgot to enter your email ';
}else{
$e = mysql_real_escape_string (Trim ($_post[' email '), $DBC);
} # Email Conditional statement
if (!empty ($_post[' Password1 ')) {
if ($_post[' password1 ']!=$_post[' Password2 ')} {
$error []= ' Your password did not match the confirmed password. ';
}else{
$p = mysql_real_escape_string (Trim ($_post[' password1 '), $DBC);
}
}else{
$error []= ' forgot to your password ';
} # Password Conditional statement
if (empty ($error)) {
$q = "INSERT into users (first_name, last_name, e-mail, pass,registration_date) VALUES (' $fn ', ' $ln ', ' $e ', SHA1 (' $p '), now () )";
[Email Protected]_query ($DBC, $q);
if ($r) {
Echo '
Thank you!
You is now registered.
';
}else{
echo "
System error
You could not bi registered due to a system error. We apolagize for any inconvenience. Mysqli_error:.mysqli_error ($DBC).
Query:. $q.
";
}
Mysqli_close ($DBC);
Include (' footer.html ');
Exit ();
}else{
Echo
error!
The following error Occurrde:
" ;
foreach ($error as $key = = $msg) {
echo "The error at $key is $msg
";
}
Echo
Please try again
";
} #错误显示
}
?>
Register
Please do it
First_Name:
Last_Name:
Email Address:
Password: