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

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

                $data['group_name'] = $_POST['group_name'];
                $data['group_time'] = $_POST['group_time'];
                $data['group_airline'] = $_POST['group_airline'];
                $data['group_go'] = $_POST['group_go'];
                $data['group_back'] = $_POST['group_back'];
                $data['group_admin'] = $_POST['group_admin'];

                
		$rs = $db->update('tbgroup',$data,'group_id',$id);
           if($rs){
            echo "0";
           } else {
            echo "00";
           }

     } else {

      if($_POST['name'] != "0") {
           
      $rs = $db->insert('tbgroup',array(
       'group_name' => $_POST['group_name'],
       'group_time' => $_POST['group_time'],
       'group_airline' => $_POST['group_airline'],
       'group_go' => $_POST['group_go'],
       'group_admin' => $_POST['group_admin'],
       'group_back' => $_POST['group_back']
            ));

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

