我遇到了一个我无法解决的错误,我尝试了多种方法,但没有结果。
我想从2个表中删除。首先删除答复。
存在:
if(isset($_POST['delete'])){
// Get form data
$delete_id = mysqli_real_escape_string($Conn, $_POST['delete_id']). " ";
$query = 'DELETE FROM replies WHERE parent_id =' .$delete_id.";" .
'DELETE FROM topics WHERE topic_id =' .$delete_id ;
if(mysqli_query($Conn, $query)){
header('Location:' .'../forum/'.'');
} else {
echo 'ERROR: ' .mysqli_error($Conn);
}
}
|
if(isset($_POST['delete'])){
// Get form data
$delete_id = mysqli_real_escape_string($Conn, $_POST['delete_id']). " ";
$query = 'DELETE * FROM replies, topics FROM replies LEFT JOIN topics WHERE parent_id = {$delete_id} AND topic_id= {$delete_id}';
if(mysqli_query($Conn, $query)){
header('Location:' .'../forum/'.'');
} else {
echo 'ERROR: ' .mysqli_error($Conn);
}
}
|
if(isset($_POST['delete'])){
// Get form data
$delete_id = mysqli_real_escape_string($Conn, $_POST['delete_id']). " ";
$query1 = 'DELETE FROM replies WHERE parent_id =' .$delete_id.;
$query2 = 'DELETE FROM topics WHERE topic_id =' .$delete_id ;
$query = $query1 . ";" . $query2;
if(mysqli_query($Conn, $query)){
header('Location:' .'../forum/'.'');
} else {
echo 'ERROR: ' .mysqli_error($Conn);
}
}