<?php require_once('../auth/auth.php');

if (isset($_POST['update_from'])) {
	$acid=$_POST['acid'];
    mysqli_query($conn,"UPDATE accounts SET 
        `ac_name`   = '".$_POST['ac_name']."',
        `ac_alise`  = '".$_POST['ac_alise']."',
        `ac_number` = '".$_POST['ac_number']."',
        `ac_email`  = '".$_POST['ac_email']."',
        `divisions` = '".$_POST['divisions']."',
        `distr`     = '".$_POST['distr']."',
        `polic_sta` = '".$_POST['polic_sta']."',
        `ac_details`= '".$_POST['ac_details']."',
        `outlet_id`  = '".$_POST['out_it']."'
          WHERE acid ='$acid' AND coid='$coid'")or die(mysqli_error($conn));
      }

        if (isset($_POST['acid']) && isset($_POST['customer_type']) && isset($_POST['dis_margin']) && isset($_POST['crlimit']) && isset($_POST['emid']) && isset($_POST['areaid']) && isset($_POST['p_terms']) ){

               mysqli_query($conn,"UPDATE accounts SET 
                `acsub_type`  = '".$_POST['customer_type']."',
                `ac_dis`     = '".$_POST['dis_margin']."',
                `cr_limit`        = '".$_POST['crlimit']."',
                `em_id`           = '".$_POST['emid']."',
                `ac_area`         = '".$_POST['areaid']."',
                `p_terms`        = '".$_POST['p_terms']."'
                  WHERE acid ='$acid' AND coid='$coid'")or die(mysqli_error($conn));

    }

?>

<?php
if (isset($_POST['customer_id'])) {
  $customer_id = $_POST['customer_id'];
  $col_name   = $_POST['col_name'];
  $col_value  = $_POST['col_value'];
  mysqli_query($conn, "UPDATE account_info SET $col_name='$col_value' WHERE acid='$customer_id'");
}
?>