<?php

session_start();
$com="AS";
include("DMMYSQLG.php");
$resultado=[];  
	  $textBus=mysqli_real_escape_string($con,$_REQUEST['term']);
	 if(trim($textBus)!=''){
             $sq_invent=mysqli_query($con ,"SELECT DISTINCT(pclave), descripcion FROM valeryus09 
                     WHERE valeryus09.modulo='".$_SESSION['mod_sis']."' AND   descripcion like '$textBus%' or
               modulo='".$_SESSION['mod_sis']."' AND   pclave like '$textBus%'  order by pclave");          
         }// @$sql = mysqli_query($con ,$sq_retrieve);
		  while(@$reg = mysqli_fetch_array($sq_invent)){
			
                      $row["label"]="(".$reg['pclave'].")".$reg['descripcion'];
                       $row["descripcion"]=$reg['descripcion'];
                      $row["id"]=$reg['pclave'];
                     
                      $row["value"]=$reg['descripcion'];
                       
              $resultado[]=$row;  
		  }
	  
          
  echo json_encode($resultado);
//$q = mysqli_real_escape_string($con,$_GET["q"]);
//$limit= mysqli_real_escape_string($con,$_GET["limit"]);
//if($_GET['tipBus']=='d')
//	$sq_invent=mysqli_query($con ,"SELECT valeryus09.descripcion,valeryus09.pclave,valeryus09.cod_var FROM valeryus09 WHERE valeryus09.modulo='".$_SESSION['mod_sis']."' AND   descripcion like '$q%' order by descripcion limit $limit");
//elseif($_GET['tipBus']=='c')
//		$sq_invent=mysqli_query($con ,"SELECT * FROM valeryus09 WHERE valeryus09.modulo='".$_SESSION['mod_sis']."' AND   pclave like '$q%' OR cod_var='$q' order by pclave limit $limit");
//while($dt_invent=mysqli_fetch_array($sq_invent)){
//	echo "$dt_invent['descripcion']|$dt_invent['pclave']\n";
//}
?>