我花了一些时间在 Internet 上搜索并使用我的代码,但我仍然无法弄清楚为什么我会收到此错误消息。这是我的代码的摘录:
} else {
if (!empty($errors) && nexus_error($nexus)==false) {
$message = "There were" . count($errors) . " errors in the form.";
} if (!empty($errors) && nexus_error($nexus)) {
$message = "There were" . count($errors) . " errors in the form.";
$message .= "A user with the username" . $nexus . " already exists in the database.";
} if (empty($errors) && nexus_error($nexus)) { //***this line causes the error
$message = "A user with the username" . $nexus . " already exists in the database.";
}
}
顺便说一下,函数 nexus_error 定义如下:
function nexus_error($sel_nexus) {
global $connection;
$query = "SELECT * FROM person WHERE nexus={$sel_nexus}";
$result_set = mysql_query($query, $connection);
confirm_query($result_set);
if (count(mysql_fetch_array($result_set)) != 0) {
return true; // bad
} else {
return false;
}
}
任何帮助都会很棒。谢谢你的时间 :)