DELETE FROM múltiplas tabelas uma consulta post_id wordpress?

This is the current code, not functional;

$pu_id = $_GET["post"];
    $getdata="SELECT * FROM `legendado`, ``dublado`, `temporadas` WHERE `post_id` =".$p_id ;
    $sqldata=$conn->query($getdata);
    $rowcount=mysqli_num_rows($sqldata);

    if($rowcount>=1){
        $deldata="DELETE FROM `legendado`, ``dublado`, `temporadas` WHERE `post_id` =".$p_id ;
    if ($conn->query($deldata) === TRUE) {


    for($i=0;$i<$big;$i++){ 
if($leg_hd[$i] !=="" || $leg_720[$i] !=="" || $leg_1080[$i] !== ""){    
$leg="INSERT INTO `legendado`( `post_id`, `episode_type`, `hdtv`, `720p`, `1080p`,  `created_by`) VALUES ('".$p_id."','leg','".$leg_hd[$i]."','".$leg_720[$i]."','".$leg_1080[$i]."','admin')";
$leg=$conn->query($leg);
}
}

for($i=0;$i<$big1;$i++){
    if($dub_hd[$i] !=="" || $dub_720[$i] !=="" || $dub_1080[$i] !== ""){
$dub="INSERT INTO `dublado`( `post_id`, `episode_type`, `hdtv`, `720p`, `1080p`,  `created_by`) VALUES ('".$p_id."','dub','".$dub_hd[$i]."','".$dub_720[$i]."','".$dub_1080[$i]."','admin')";
$dub=$conn->query($dub);
}
}

for($i=0;$i<$big2;$i++){
    if($temp_hd[$i] !=="" || $temp_720[$i] !=="" || $temp_1080[$i] !== ""){
$temp="INSERT INTO `temporadas`( `post_id`, `episode_type`, `temphdtv`, `temp720p`, `temp1080p`,  `created_by`) VALUES ('".$p_id."','temp','".$temp_hd[$i]."','".$temp_720[$i]."','".$temp_1080[$i]."','admin')";
$temp=$conn->query($temp);
}
}

    }   
    }

Queria uma solução fazer o delete nas tabelas, “legendado, dublado, temporadas”, usando a sintaxe;

 $pu_id = $_GET["post"];
        $getdata="SELECT * FROM `legendado`, ``dublado`, `temporadas` WHERE `post_id` =".$p_id ;
        $sqldata=$conn->query($getdata);
        $rowcount=mysqli_num_rows($sqldata);

        if($rowcount>=1){
            $deldata="DELETE FROM `legendado`, ``dublado`, `temporadas` WHERE `post_id` =".$p_id ;
        if ($conn->query($deldata) === TRUE) {

Could you help me with this code? thanks in advance!

Read more here: DELETE FROM múltiplas tabelas uma consulta post_id wordpress?

Leave a Reply

Your email address will not be published. Required fields are marked *