我從w3schools得到了這個php腳本,我想知道是否可能只刪除姓並留下彼得的名字?從數據庫中只刪除某些東西
<?php
$con=mysqli_connect("example.com","peter","abc123","my_db");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
mysqli_query($con,"DELETE FROM Persons WHERE LastName='Griffin'");
mysqli_close($con);
?>
來源: http://www.w3schools.com/php/php_mysql_delete.asp
你需要做'UPDATE'和'SET'(替換)爲了做到這一點,「格里芬」沒有任何東西。 –