0

我正在尝试根据 mySQL 表查询的结果比较来设置开关。如果我使用打印或回显,则查询有效,但在尝试使用完全相同的循环进行比较时会引发语法错误。引发错误的比较代码如下。

//Define query for database entry lookup
$sql = "SELECT * FROM email_auth WHERE useremail='$user_email_address'";

//Define result for database entry lookup
$result = mysql_query($sql) or die(mysql_error());

//Find match for email authentication
$email_count = 0;
while($row = mysql_fetch_assoc($result)){
  if ( $row['authID'] == $user_email_auth ) { $validemailrequest = "true" }  //Line 60
  $email_count++;
}

而我得到的错误......

<b>Parse error</b>:  syntax error, unexpected '}' in
<b>/home/user/public_html/send_email.php</b> on line <b>60</b>

然而,在使用相同的打印时有效......

//Define query for database entry lookup
$sql = "SELECT * FROM email_auth WHERE useremail='$user_email_address'";

//Define result for database entry lookup
$result = mysql_query($sql) or die(mysql_error());

//Find match for email authentication
$email_count = 0;
while($row = mysql_fetch_assoc($result)){
  print $row['authID'];
  $email_count++;
}
4

3 回答 3

1

条件代码后似乎缺少一个分号。

while($row = mysql_fetch_assoc($result)){
    if ( $row['authID'] == $user_email_auth ) { $validemailrequest = "true"; }  //Line 60
    $email_count++;
}
于 2012-12-03T21:03:14.103 回答
0

此行缺少分号;

$validemailrequest = "true";
于 2012-12-03T20:59:53.320 回答
0

后缺少分号$validemailrequest = "true"

于 2012-12-03T21:00:00.670 回答