我在尝试使用PHP中创建删除表单以使用提供给客人的ID删除数据时遇到问题。我是这种东西的新手。
这是错误:
Error: DELETE FROM MyGuests WHERE id= LIMIT 1
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'LIMIT 1' at line 1
这是我的删除.php:
<?php
include_once('mysql.php');
$ins= "DELETE FROM MyGuests WHERE id=$id LIMIT 1";
if ($conn->query($ins) === TRUE) {
echo "Record deleted successfully";
} else {
echo "Error: " . $ins . "<br>" . $conn->error;
}
?>
<!DOCTYPE html>
<html>
<body>
<a href='index.php'>Home</a><br>
<h2>Delete User</h2>
<form action="/delete.php" method="post">
Guest ID:<br>
<input type="text" name="id" >
<br><br>
<input type="submit" value="Submit">
</form>
</body>
</html>
蝴蝶刀刀
慕工程0101907