我正在尝试从表中删除所有行,但它不起作用。当我这样做时,echo $mydb->error;
它给了我以下信息:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '* FROM messages where from_user = ? and id = ?'
$user = 'currentuser';
if (isset($_POST['delete'])) {
if(!empty($_POST['id'])){
$id = $_POST['id'];
$mydb = new mysqli('localhost', 'root', '', 'database');
$stmt = $mydb->prepare("DELETE * FROM messages where from_user = ? and id = ? ");
echo $mydb->error;
$stmt->bind_param('ss', $user, $id);
foreach ($_POST['id'] as $id) {
$stmt->execute();
}
echo"The Message deleted permanently";
}
}