security fix in master branch
[openemr.git] / library / ajax / prescription_drugname_lookup.php
blob56750e4b28ed7eefc582d2ef7dc74d99033314c4
1 <?php
2 // Copyright (C) 2008 Jason Morrill <jason@italktech.net>
3 //
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 2
7 // of the License, or (at your option) any later version.
8 //
9 // This file use is used specifically to look up drug names when
10 // writing a prescription. See the file:
11 // templates/prescriptions/general_edit.html
12 // for additional information
14 // Important - Ensure that display_errors=Off in php.ini settings.
16 include_once("../../interface/globals.php");
18 $q = formData("q", "G", true);
19 if (!$q) {
20 return;
23 $limit = $_GET['limit'];
25 $sql = "select drug_id, name from drugs where ".
26 " name like ('".$q."%')".
27 " order by name ".
28 " limit ".$limit;
29 $rez = sqlStatement($sql);
31 while ($row = sqlFetchArray($rez)) {
32 echo $row['name']."|".$row['drug_id']."\n";