ok
Direktori : /home2/selectio/www/lilyexpresslive/software/admin/emergency-code/ |
Current File : /home2/selectio/www/lilyexpresslive/software/admin/emergency-code/pickup-entry-last-date-update.php |
<?php include("../inc/config.php"); //Delete Pickup Entry Details //if(isset($_POST['type']) && $_POST['type']=="last_date_pickup_entry"){ $response='';$sql=''; $statement = $pdo->prepare("SELECT count(id) as count FROM `pickup_entry` WHERE last_updated_status_date is NULL"); $statement->execute(); $s_results = $statement->fetchAll(PDO::FETCH_ASSOC); echo "Remaining Count :".$s_results[0]['count'].'<br><br>'; $statement = $pdo->prepare("SELECT pickup_entry.id,(select created_at from tbl_tracking where pickup_entry_id=pickup_entry.id order by t_id limit 1) as last_update_date,(select delivery_date from tbl_tracking where pickup_entry_id=pickup_entry.id order by t_id limit 1) as delivery_date FROM `pickup_entry` WHERE pickup_entry.last_updated_status_date is NULL order by pickup_entry.id desc LIMIT 150"); $statement->execute(); $totals = $statement->rowCount(); $results = $statement->fetchAll(PDO::FETCH_ASSOC); if($totals>0){ $i=1; //echo $totals.'---'; foreach($results as $rows){ // echo $i."---"; if($rows['delivery_date']==NULL || $rows['delivery_date']=="0000-00-00"){ $rows['delivery_date']=$rows['last_update_date']; } if($rows['last_update_date']!="0000-00-00" && $rows['delivery_date']!="0000-00-00"){ $statement = $pdo->prepare("UPDATE pickup_entry SET last_updated_status_date=?,delivered_date=? WHERE id=?"); $resultls=$statement->execute(array($rows['last_update_date'],$rows['delivery_date'],$rows['id'])); if($resultls){echo $i." .success "; }else{echo $i." .invalid<br>";} }else{ echo "Failed...<br>"; } $i++; } }else{ echo "<br>invalid<br>";} ?>