<?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(n_reg), ntipo, ncto 
                     FROM valeryus08 WHERE  ntipo like '$textBus%' or 
                        ncto like '$textBus%'  order by n_reg");
             }
		 // @$sql = mysqli_query($con ,$sq_retrieve);
		  while(@$reg = mysqli_fetch_array($sq_invent)){
			
                      $row["label"]="(".$reg['ncto'].")".$reg['ntipo'];
                       $row["ntipo"]=$reg['ntipo'];
                      $row["id"]=$reg['n_reg'];
                      $row["ncto"]=$reg["ncto"];
                      $row["value"]=$reg['ntipo'];
                       
              $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 valeryus08.ntipo, valeryus08.ncto FROM valeryus08, valeryus05 WHERE valeryus05.modulo='".$_SESSION['mod_sis']."' AND ncto like '$q%' order by ncto limit $limit");
//elseif($_GET['tipBus']=='c')
//		$sq_invent=mysqli_query($con ,"SELECT * FROM valeryus05 WHERE valeryus05.modulo='".$_SESSION['mod_sis']."' AND   n_reg like '$q%' OR cod_var='$q' order by n_reg limit $limit");
//if(!$sq_invent)die(mysqli_error($con));
//		while($dt_invent=mysqli_fetch_array($sq_invent)){
//	echo "$dt_invent['descripcion']|$dt_invent['n_reg']\n";
//}
?>