<?php

session_start();
$com="AS";
include("DMMYSQLG.php");
$resultado=[];

  
	  $textBus=mysqli_real_escape_string($con,$_REQUEST['term']);
	  if(trim($textBus)!=''){
                $sq_invent="SELECT DISTINCT(nparte1),descripcion FROM ctmesas WHERE  descripcion like '$textBus%' or
                    nparte1 like '$textBus%'  order by nparte1 "; 
                 }
		  @$sql = mysqli_query($con ,$sq_invent);
		  while(@$reg = mysqli_fetch_array($sql)){
			
                      $row["label"]="(".$reg['nparte1'].")".$reg['descripcion'];
                       $row["descripcion"]=$reg['descripcion'];
                      $row["id"]=$reg['nparte1'];
                      $row["value"]=$reg['descripcion'];
                       
              $resultado[]=$row;  
		  }
	  
          
  echo json_encode($resultado);
//include("DSA1000.php");
//include("DMMYSQLG.php");
//
//$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 ctmesas.np_desc1,ctmesas.nparte1 FROM ctmesas WHERE  np_desc1 like '$q%' order by np_desc1 limit $limit");
//elseif($_GET['tipBus']=='c')
//		$sq_invent=mysqli_query($con ,"SELECT * FROM ctmesas WHERE nparte1 like '$q%' OR cod_var='$q' order by nparte1 limit $limit");
//while($dt_invent=mysqli_fetch_array($sq_invent)){
//	if(isset($dt_invent['np_desc1'])&&$dt_invent['np_desc1']==''){
//            echo'$dt_invent["np_desc1"]';
//        }  
//                
//            if(isset($dt_invent['nparte1'])&&$dt_invent['nparte1']==''){
//                echo'$dt_invent["nparte1"]';
//            }
//}
?>
