<?php
include 'include/db.php';
include 'include/connect.php';
$id = $_POST['id'];

if(!empty($id) && $_POST['code'] != "0"){
                
                $data['package_banner'] = $_POST['image_field'];
                $data['package_name'] = $_POST['package_name'];
                $data['package_code'] = $_POST['package_code'];
                $data['package_price'] = $_POST['package_price'];
                $data['package_country'] = $_POST['package_country'];
                $data['package_airline'] = $_POST['package_airline'];
                $data['package_time'] = $_POST['package_time'];
                $data['package_file'] = $_POST['series_field'];
                $data['package_card'] = $_POST['package_card'];
                $data['package_wholesale'] = $_POST['package_wholesale'];
                $data['package_status'] = $_POST['package_status'];
                
                
		$rs = $db->update('tbpackage',$data,'package_id',$id);
           if($rs){
            echo "0";
           } else {
            echo "00";
           }

     } else {

      if($_POST['package_name'] != "" && $_POST['package_country'] != 0 && $_POST['package_airline'] != 0) {
      $rs = $db->insert('tbpackage',array(
       'package_banner' => $_POST['image_field'],
       'package_name' => $_POST['package_name'],
       'package_code' => $_POST['package_code'],
       'package_price' => $_POST['package_price'],
       'package_country' => $_POST['package_country'],
       'package_airline' => $_POST['package_airline'],
       'package_time' => $_POST['package_time'],
       'package_file' => $_POST['series_field'],
       'package_card' => $_POST['package_card'],
       'package_wholesale' => $_POST['package_wholesale'],
       'package_status' => $_POST['package_status']
            ));

           if($rs){
            echo "2";
           } else {
            echo "0";
           }
         } else {
            echo "3";
        }
}
?>

