This commit helps in the following
[openemr.git] / library / ajax / prescription_drugname_lookup.php
blobb6700c1c0d865f88ea622e97f7f72ff5d69acbeb
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");
17 include_once("{$GLOBALS['srcdir']}/sql.inc");
18 include_once("{$GLOBALS['srcdir']}/formdata.inc.php");
20 $q = formData("q","G",true);
21 if (!$q) return;
22 $limit = $_GET['limit'];
24 $sql = "select drug_id, name from drugs where ".
25 " name like ('".$q."%')".
26 " order by name ".
27 " limit ".$limit;
28 $rez = sqlStatement($sql);
30 while ($row = sqlFetchArray($rez)) {
31 echo $row['name']."|".$row['drug_id']."\n";