several fixes to prior commit
[openemr.git] / library / ajax / imm_autocomplete / search.php
blobc20074f5ec91cae47f401862af962693b4b066f1
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
21 //SANITIZE ALL ESCAPES
22 $sanitize_all_escapes=true;
25 //STOP FAKE REGISTER GLOBALS
26 $fake_register_globals=false;
28 require_once('../../../interface/globals.php');
31 if (!empty($_GET['term'])){
32 $term = $_GET['term'];
33 $return_arr = array();
35 $sql = "SELECT DISTINCT lot_number FROM immunizations WHERE lot_number LIKE ?";
36 $res = sqlstatement($sql, array("%".$term."%"));
37 while($row = sqlFetchArray($res)){
38 $return_arr[] = $row['lot_number'] ;
41 /* Toss back results as json encoded array. */
42 echo json_encode($return_arr);