<?php session_start();

	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 "text22":
      $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;
}
}

//echo "dave22";

include("configi.php");

$outlet_id = 1;

$cat_id		=	$_REQUEST['cat_id'];
$btn_sel		=	$_REQUEST['btn_sel'];


		$queryupdate = "update ".$_COOKIE['phxcrmclient_id']."_catpos_sel set cp_sel = ".$btn_sel;

		echo $queryupdate;

		$result=mysqli_query($conn, $queryupdate);

		if($result){ 
			$result_message = ""; 
		} else { 
			$result_message = "update failed" . $result . mysqli_error($conn);
		}
		
		echo $result_message;
		
		exit;

