31 lines
674 B
PHP
31 lines
674 B
PHP
<?php
|
|
|
|
$db=$GLOBALS['db'];
|
|
|
|
if($_REQUEST['query']!=""){
|
|
|
|
$result['fields']=[];
|
|
if($_REQUEST['type']=='EcmProducts'){
|
|
$query="select id,code,name from ecmproducts where deleted=0 and code like '".$_REQUEST['query']."%' limit 10";
|
|
|
|
$zap = $db->query($query);
|
|
|
|
while($dane=$db->fetchByAssoc($zap)){
|
|
$result['fields'][]=$dane;
|
|
}
|
|
}
|
|
|
|
if($_REQUEST['type']=='EcmActions'){
|
|
$query="select id,name from ecmactions where deleted=0 and name like '%".$_REQUEST['query']."%' limit 10";
|
|
|
|
$zap = $db->query($query);
|
|
|
|
while($dane=$db->fetchByAssoc($zap)){
|
|
$result['fields'][]=$dane;
|
|
}
|
|
}
|
|
|
|
|
|
echo json_encode($result);
|
|
}
|
|
?>
|