Highway to PSR2
[openemr.git] / library / ajax / imm_autocomplete / search.php
blobe04166d317b61bcbfab57b387774fed1ca2870ff
1 <?php
3 /** Copyright (C) 2016 Sherwin Gaddis <sherwingaddis@gmail.com>
5 * LICENSE: This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
16 * @package OpenEMR
17 * @author Sherwin Gaddis <sherwingaddis@gmail.com>
18 * @link http://www.open-emr.org
22 require_once('../../../interface/globals.php');
25 if (!empty($_GET['term'])) {
26 $term = $_GET['term'];
27 $return_arr = array();
29 $sql = "SELECT DISTINCT lot_number FROM immunizations WHERE lot_number LIKE ?";
30 $res = sqlstatement($sql, array("%".$term."%"));
31 while ($row = sqlFetchArray($res)) {
32 $return_arr[] = $row['lot_number'] ;
35 /* Toss back results as json encoded array. */
36 echo json_encode($return_arr);