	<?php
		date_default_timezone_set("Pacific/Auckland");

if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }
  
  	include("configi.php");


  $theValue = function_exists("mysqli_real_escape_string") ? mysqli_real_escape_string($conn, $theValue) : mysqli_escape_string($conn, $theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

	 include 'configi.php';	

	$date_from			=  $_REQUEST['date_from'];

	$sel_region			=  $_REQUEST['sel_region'];

	$sel_status			=  $_REQUEST['sel_status'];

		 if ($date_from == ""){
	
		echo "invalid date parameter";
		
		exit;
		
		 
	 }
	

	

	 
	  $date_from2 = date("Y-m-d", strtotime($date_from));  
	  

	 

//	echo "notnot";	insert into 
		$queryclient = "insert into  ".$_COOKIE['phxcrmclient_id']."_pay_run(date_from, sel_region, sel_status) values('".$date_from2."','".$sel_region."','".$sel_status."')";

		echo $queryclient;
		
		$resultclient=mysqli_query($conn, $queryclient);
		
	

	
		
	
	
			
			?>