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

if(!empty($id) && $_POST['name'] != "0"){

                $data['airline_name'] = $_POST['name'];
                $data['airline_code'] = $_POST['code'];
                
		$rs = $db->update('tbairline',$data,'airline_id',$id);
           if($rs){
            echo "0";
           } else {
            echo "00";
           }

     } else {

      if($_POST['name'] != "0") {
           
      $rs = $db->insert('tbairline',array(
       'airline_name' => $_POST['name'],
       'airline_code' => $_POST['code']
            ));

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

