


mysql_real_escape_string() expects parameter 2 to be resource, object given in,该怎么解决
Jun 13, 2016 am 10:23 AM
mysql_real_escape_string() expects parameter 2 to be resource, object given in
代码如下:
$page_title = 'Register ';
include("header.html"); #网页头部
?>
if(isset($_POST['submitted'])){
require_once("mysqli_connect.php");
$error=array(); #定义错误为数组
if (empty($_POST['first_name'])){
$error[]='you forgot to enter you first name';
}else{
$fn= mysql_real_escape_string(trim($_POST['first_name']),$dbc);
} #first name 条件语句
if (empty($_POST['last_name'])) {
$error[]='you forgot to enter you last name';
}else{
$ln= mysql_real_escape_string(trim($_POST['last_name']),$dbc);
} #last name 条件语句
if (empty($_POST['email'])){
$error[]='you forgot to enter you email';
}else{
$e= mysql_real_escape_string(trim($_POST['email']),$dbc);
} # email 条件语句
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[]='you forgot to your password';
} # password 条件语句
if(empty($error)){
$q="INSERT INTO users (first_name, last_name, email, pass,registration_date) VALUES ('$fn','$ln','$e',SHA1('$p'),now())";
[email protected]_query ($dbc ,$q);
if($r){
echo '
Thank you !
you are 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

인기 기사

인기 기사

뜨거운 기사 태그

메모장++7.3.1
사용하기 쉬운 무료 코드 편집기

SublimeText3 중국어 버전
중국어 버전, 사용하기 매우 쉽습니다.

스튜디오 13.0.1 보내기
강력한 PHP 통합 개발 환경

드림위버 CS6
시각적 웹 개발 도구

SublimeText3 Mac 버전
신 수준의 코드 편집 소프트웨어(SublimeText3)

뜨거운 주제











페이지로 이동하기 위한 매개변수가 포함된 PHP의 POST 메소드에 대한 간략한 분석

iPhone에서 App Store 오류에 연결할 수 없는 문제를 해결하는 방법

Java는 어떻게 http 요청을 시작하고 게시물을 호출하고 인터페이스를 얻습니까?

NGINX 리버스 프록시가 HTML 페이지의 POST 요청에 대해 405를 반환하는 문제를 해결하는 방법
