ok
Direktori : /home2/selectio/www/lilyexpresslive/software/admin/emergency-code/ |
Current File : /home2/selectio/www/lilyexpresslive/software/admin/emergency-code/pickup-entry-delete-ids.php |
<?php include("../inc/config.php"); //Delete Pickup Entry Details if(isset($_POST['type']) && $_POST['type']=="delete_pickup_entry"){ $response='';$sql=''; $delete_pickupentry_id="0"; $delete_id.=",".$ids; $delete_customer_id="0"; $statement = $pdo->prepare("SELECT id,customer_id FROM `pickup_entry` where pickup_entry.created_at BETWEEN '2020-01-01' and '2022-07-31' order by pickup_entry.id asc LIMIT 5000"); $statement->execute(); $results = $statement->fetchAll(PDO::FETCH_ASSOC); foreach ($results as $row) { $p_id = $row['id']; $delete_pickupentry_id.=",".$p_id; $delete_customer_id.=",".$row['customer_id']; } $statement = $pdo->prepare("delete from pickup_entry WHERE id in (".$delete_pickupentry_id.") ;delete from tbl_tracking WHERE pickup_entry_id in (".$delete_pickupentry_id.") ;delete from tbl_pod WHERE awb_id in (".$delete_pickupentry_id.") ;"); $result=$statement->execute(); $sql.="delete from pickup_entry WHERE id in (".$delete_pickupentry_id.") ;delete from tbl_tracking WHERE pickup_entry_id in (".$delete_pickupentry_id.") ;delete from tbl_pod WHERE awb_id in (".$delete_pickupentry_id.") ;delete from tbl_customer WHERE cust_type='one_time' and cust_id in (".$delete_customer_id.") ;"; error_log('Delete Query Details:'.$sql); if($result){ echo "Successfully Deleted ".count($results)." Records"; }else{ echo "Failed"; } } ?>