我有我的兩個IF ELSE語句示數出來,但不是第三個問題。的if else變量問題
注意:試圖讓非對象的財產employees2.php線51個 0結果
// Pass appropriate SQL to the database
$lname = htmlspecialchars($_POST["lname"]);
$fname = htmlspecialchars($_POST["fname"]);
$empid = htmlspecialchars($_POST["empid"]);
echo "<h3>Search results.</h3>";
$sqlL = "SELECT * FROM employees WHERE LAST_NAME = \"" . $lname . "\"";
$sqlF = "SELECT * FROM employees WHERE FIRST_NAME \"" . $fname . "\"";
$sqlID = "SELECT * FROM employees WHERE EMPLOYEE_ID \"" . $empid . "\"";
$resultL = $conn->query($sqlL);
$resultF = $conn->query($sqlF);
$resultID = $conn->query($sqlID);
if ($resultF->num_rows > 0) {
// Output data of each row
printf("\n\t<table><th>Name</th>
<th>Employee ID</th>
");
while ($row = $resultF->fetch_assoc()) {
printf("\n\t<tr><td>%s%s</td>
<td>%s</td></tr>",
$row["LAST_NAME"], $row["FIRST_NAME"], $row["EMPLOYEE_ID"]);
}
echo "</table>\n";
echo "<h5><strong>($resultF->num_rows) results returned.</strong></h5><br>";
} else {
echo "0 results ";
}
你缺少你'='在'$ sqlF' && '$ sqlID'查詢 - >'... WHERE FIRST_NAME \「」。 $ fname。 「\」「;'/'...WHERE EMPLOYEE_ID \」「。$ empid。」\「」;'。所以,你的查詢失敗,那麼你的'$ resultF'和'$ resultID'會導致'非object's – Sean