我从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);
?>
答案 0 :(得分:1)
是的,只是做
UPDATE Persons
set LastName = ''
WHERE
id = ?
或者设置LastName = NULL