0

运行以下代码时出现问题:

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;
}

它总是提示“Parse error: syntax error, unexpected '$result' (T_VARIABLE) in F:\xampp\htdocs\sql.php on line 76”

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

4

3 回答 3

15

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

$key = md5("secure");
于 2012-11-12T09:23:45.723 回答
5
$key=md5("secure")

导致错误。你忘记了分号。这就是为什么拥有一个带有内置 PHP 解析器的 IDE 可以节省您的时间和精力的原因。

于 2012-11-12T09:23:49.543 回答
4

之后你失踪;$key=md5("secure")

找出遗漏分号的最简单方法是查看发生错误的行的前一行。

于 2012-11-12T09:24:21.913 回答