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

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

                $data['country_name_eng'] = $_POST['name'];
                $data['country_name'] = $_POST['nameth'];
                
		$rs = $db->update('tbcountry',$data,'country_id',$id);
           if($rs){
            echo "0";
           } else {
            echo "00";
           }

     } else {

      if($_POST['name'] != "0") {
           
      $rs = $db->insert('tbcountry',array(
       'country_name_eng' => $_POST['name'],
       'country_name' => $_POST['nameth']
            ));

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

