我不斷收到這一個錯誤,我不明白: 解析錯誤:語法錯誤,意想不到的')'在第14行/home/u776686576/public_html/index.php 它不期望一個結束括號, 但爲什麼?沒有任何理由不需要一個。請幫忙。PHP MySql解析錯誤
<?php
require_once("conx.php");
$email = $_POST["email"];
$username = $_POST["username"];
$p1 = $_POST["p1"];
$p2 = $_POST["p2"];
$gender = $_POST["gender"];
$sql = "SELECT id FROM users WHERE email='$email' LIMIT 1";
$query = mysqli_query($conx, $sql);
$u_checker - mysqli_num_rows($query);
$sql = "SELECT id FROM users WHERE username='$username' LIMIT 1";
$query = mysqli_query($conx, $sql);
$e_checker - mysqli_num_rows($query);
if ($username == "" || $email == "" || $p1 == "" || $p2 == "" || $gender == "" ||) {
echo "Missing fields.";
exit();
} else if (!$p1 == $p2) {
echo "Passwords don't match.";
exit():
} else if ($u_checker > 0) {
echo "Username taken."
exit();
} else if ($e_checker > 0) {
echo "Email address in use already.";
exit();
} else if (is_numeric($u[0])) {
echo "Username cannot begin with a number";
} else {
echo $email;
echo $username;
echo $p1;
echo $p2;
echo $gender
}
?>
<html>
<head>
<title>Sign Up</title>
</head>
<body>
<form method="post" action="signup.php">
<h3>Username</h3><br>
<input type="text" name="username"><br>
<h3>Email Address</h3>
<input type="email" name="email">
<h3>Password</h3>
<input type="password" name="p1">
<h3>Password Again</h3>
<input type="password" name="p2">
<h3>Gender</h3>
<select name="gender">
<option>Male</option>
<option>Female</option>
</select>
<button type="submit">Sign Up</button>
</form>
</body>
</html>
「'||)'」 - 真的嗎? – deceze
你的if語句結束'||)' - 它期望別的東西來評估和得到括號。 – andrewsi
我看到太多這樣的問題。花時間學習如何[解釋錯誤並修復代碼](http://jason.pureconcepts.net/2013/05/fixing-php-errors/)。 –