解析错误:语法错误,意外'$ result'(T_VARIABLE)

Art*_*Art -1 php mysql

我运行以下代码时遇到问题:

function newUser($email,$pwd,$pwd2,$firstname,$surname,$isAdmin=0){
  $email = $this->verify('Email',$email,10,40);
  $pwd = $this->verify('Password',$pwd,6,20);
  $pwd2 = $this->verify('Password',$pwd2,6,20);
  $firstname = $this->strToTitle($this->verify('Name',$firstname,2,40));
  $surname = $this->strToTitle($this->verify('Title',$surname,2,40));
  if ($pwd != $pwd2)
    return -1;
    $key=md5("secure")
  $result = $this->query("INSERT INTO user (email, pw, firstname, surname, isAdmin) VALUES (".$email.", AES_ENCRYPT(".$pwd.",".$key."), ".$firstname.", ".$surname.", ".$isAdmin.")");
  if (mysql_affected_rows()>0)
    return mysql_insert_id();
  else
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

它始终在第76行的F:\ xampp\htdocs\sql.php中提示"解析错误:语法错误,意外'$结果'(T_VARIABLE)"

任何人都可以给我一些建议吗?非常感谢!!

Gra*_*mas 14

在分配查询结果的行上缺少分号$result,它应该是:

$key = md5("secure");
Run Code Online (Sandbox Code Playgroud)


Way*_*tty 5

$key=md5("secure")
Run Code Online (Sandbox Code Playgroud)

导致错误.你忘记了你的分号.这就是为什么拥有内置PHP解析器的IDE将节省您的时间和精力.