<?php 
require "../commonincludefiles.php";

$command = "";
$out = "";
$query = "";

if (isset($_POST["cmd"])) {
	$command = $_POST["cmd"];
}
if (isset($_POST["query"])) {
	$query = $_POST["query"];
}
if (isset($_POST["customer_id"])) {
	$query = $_POST["customer_id"];
}

switch ($command) {

  case "movies":
   $out = GetMovies($query);
    break;
		
}

echo utf8_encode($out);




function GetMovies($query) {
    
  $retVal = "[]";
  $objCustomerMgmt = new CustomerMgmt();
	

  if (strlen($query) > 0) {
	$condition = " AND customer_orgname like '%" . $query . "%'"; 
  }
  
	
	$result =$objCustomerMgmt->getAllRecords(0,0,$condition,"","");
	$total  = dbRows($result);

	$i = 0;   
	
	$movies = array("count" => $num, "movies" => array());
	
	while ($row = mysql_fetch_assoc($result)) {    
		$movies["movies"][$i] = $row;    
		$i++;  
	}   
	
	return json_encode($movies); 
 }
?>