我正在尝试根据 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++;
}