Files
2026-04-27 10:26:26 +07:00

38 lines
894 B
PHP

<?php
class Lookup extends MY_Controller
{
public function __construct() {
parent::__construct();
$this->db_smartone = $this->load->database("onedev", true);
}
function dropdown($sp) {
$sql = "call $sp";
$qry = $this->db_smartone->query($sql);
if (! $qry) {
echo json_encode(array());
}
$rows = $qry->result_array();
if (count($rows) == 0 ) {
echo json_encode(array());
}
echo json_encode($rows);
}
function ac($sp) {
$prm = $this->sys_input;
$search = $prm['search'];
$sql = "call $sp(?)";
$qry = $this->db_smartone->query($sql,array($search));
if (! $qry) {
echo json_encode(array());
}
$rows = $qry->result_array();
if (count($rows) == 0 ) {
echo json_encode(array());
exit;
}
echo json_encode($rows);
}
}