ok
Direktori : /home2/selectio/www/lilyexpresslive/software/admin/ajax-code-api/ |
Current File : /home2/selectio/www/lilyexpresslive/software/admin/ajax-code-api/upload-awbnumbers.php |
<?php ob_start(); session_start(); include("../inc/config.php"); try{ $start=$_POST['start_awb']; $end=$_POST['end_awb']; $content=''; $failed=0; for($i=$start;$i<=$end;$i++){ $statement = $pdo->prepare("SELECT * FROM `pickup_entry` where ref_no=$i"); $statement->execute(); $results = $statement->fetchAll(PDO::FETCH_ASSOC); if($results){ $content.=$i.' Awb Number already used...<br>'; $failed++; }else{ $statement = $pdo->prepare("SELECT * FROM `tbl_awbs` where awb_code=$i"); $statement->execute(); $results = $statement->fetchAll(PDO::FETCH_ASSOC); if($results){ $content.=$i.' Awb Number already Uploaded...<br>'; $failed++; }else{ $statement = $pdo->prepare("INSERT INTO tbl_awb (awb_code,client_id,status) VALUES (?,?,?)"); $result=$statement->execute(array($i,$_POST['client_id'],1)); if(!$result){ $content.=$i.' Failed<br>'; $failed++; } } } } if($content==''){ $content=($i-$failed).' Awb numbers Uploaded...'; echo "<center><b style='color:green;'>".$content."</b><br><br><br><a href='awb-list.php' class='btn btn-warning btn-sm'>Back to List Awb Numbers</a></center>"; }else{ echo "<center><b style='color:red;'>"($i-$failed)." ".$content." <span style='color:green;'>Reminaing All Awb Numbers Added..</span></b><br><a href='awb-list.php' class='btn btn-warning btn-sm'>Back to List Awb Numbers</a></center>"; } }catch(Exception $e){ echo 'Falied...'; } ?>