0
我希望你能給我一個我無法弄清楚的建議。我正在嘗試爲我爲項目創建的數據庫創建更新功能。我希望它和我創建的插入和刪除功能一樣,但我不知所措...... 這是我創建的。更新功能不起作用
<!DOCTYPE html>
<html>
<body>
<h1>Franchise Call Log</h1>
<?php
$con=mysqli_connect("","","","");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result = mysqli_query($con,"SELECT * FROM caller_info");
echo "<table border='1'>
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Franchise</th>
</tr>";
while($row = mysqli_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['Firstname'] . "</td>";
echo "<td>" . $row['Lastname'] . "</td>";
echo "<td>" . $row['Franchise'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysqli_close($con);
?>
</body>
</html>
<h1>Insert a New Caller</h1>
<form action="insert.php" method="post">
Firstname: <input type="text" name="firstname">
Lastname: <input type="text" name="lastname">
Franchise: <input type="text" name="franchise">
<input type="submit" name="submit">
</form>
</body>
</html>
<html>
<body>
<h1>Delete a Caller</h1>
<form action="delete.php" method="post">
Lastname: <input type="text" name="lastname">
<input type="submit" name="submit">
</form>
</body>
</html>
<html>
<body>
<h1>Update a Caller</h1>
<form action="update.php" method="post">
Firstname: <input type="text" name="firstname">
Lastname: <input type="text" name="lastname">
Franchise: <input type="text" name="franchise">
<input type="submit" name="submit">
</form>
</body>
</html>
<!DOCTYPE html>
<html>
<body>
<h1>Your records have been updated</h1>
<?php
$con=mysqli_connect("");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
mysqli_query($con,"UPDATE Caller_info SET Firstname = '$firstname' WHERE Lastname '$lastname'");
mysqli_close($con);
?>
</body>
</html>
的問題,雖然是有脫節的地方。我有它顯示的第一個,最後一個和特許經營的名字,但它沒有給我一些更新。希望這是有道理的? – user3105751