fhiiqm/inc/fkt_list_ac.inc.php
changeset 7 d2fe4fb36670
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fhiiqm/inc/fkt_list_ac.inc.php	Thu Sep 08 15:25:25 2011 +0200
@@ -0,0 +1,32 @@
+<?php
+
+/**
+ * @author Bettina Schwarzer, Fritz-Haber-Institut
+ * @copyright 09/2011
+ *
+ * Autocomplete Funktionensuche
+ */
+
+    header('Content-type: text/html; charset="iso-8859-1',true); //wg. jquery ui autocomplete
+    error_reporting(E_ALL ^ E_NOTICE);
+    
+    $q = strtolower($_GET["term"]); // wird in jquery in 'term' uebergeben
+
+    
+	include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php");
+	$dbc = new dbconnection();
+
+    $sql = "SELECT fkt_bez as label, fkt_bez as val, fkt_ID as id FROM `fhiiqm`.`Funktion` 
+            WHERE fkt_bez LIKE '%".$q."%' COLLATE latin1_general_ci 
+            ORDER BY 1";
+    $result = $dbc ->queryObjectArray($sql);
+    if ($result)
+    {
+        foreach ($result as $row)
+        {
+ 			$clist[] = "{\"label\": \"" . $row->label . "\",\"value\": \"" . $row->val . "\",\"id\": \"" . $row->id . "\"}";
+		}
+        echo "[" . implode(", ", $clist) . "]"; // Format, das jquery source erwartet
+    }
+    $dbc -> close();
+?>
\ No newline at end of file