好的我有下面的代碼,但我的sql查詢不會顯示結果,所以我總結sql語句一定是錯的?sql php where statement not working correctly
請有人讓我知道我做錯了什麼嗎?
感謝
$result=mysqli_query("SELECT * FROM Persons WHERE Day = '".$_POST['Day']."' AND Time = '".$_POST['Time']."'");
echo "Query Runs";
echo "<table border='1'>
<tr>
<th>Name</th>
<th>Day</th>
<th>Time</th>
<th>Reg</th>
</tr>";
echo "Delete a Booking today ";
while($row = mysqli_fetch_array($query))
{
echo "<tr>";
echo "<td>" . $row['Name'] . "</td>";
echo "<td>" . $row['Day'] . "</td>";
echo "<td>" . $row['Time'] . "</td>";
echo "<td>" . $row['Reg'] . "</td>";
echo "</tr>";
}
echo "</table>";
這是無法正常運轉的下面將要運行的SQL語句。 $ result = mysqli_query(「SELECT * FROM Persons WHERE Day ='」。$ _ POST ['Day']。''AND Time ='「。$ _ POST ['Time']。」'「);
的下面都不會返回結果之一:
$result=mysqli_query("SELECT * FROM Persons WHERE Day = '".$_POST['Day']."' AND Time = '".$_POST['Time']."'";
$result=mysqli_query("SELECT * FROM Persons WHERE Day = '$_POST[Day]' AND Time = '$_POST[Time]' ")
是否確定POST值可用? –
omg你的查詢....使用mysqli並不意味着你是從sql注入安全...哦,你也需要執行查詢 –
你應該包括'DAY''$ _POST ['Day']'和' $ _POST ['Time']' – marsze