fhiiqm/inc/al_list_ac.inc.php
author Bettina Schwarzer <schwarzer@fhi-berlin.mpg.de>
Thu, 12 Jan 2012 11:41:22 +0100
changeset 22 aae5b0ecc47b
parent 19 33ee23fafd4d
child 26 3c1e3ac7089f
permissions -rw-r--r--
+ Laser iud+copy, Laserliste, Rechte/Nutzer-Tab

<?php

/**
 * @author Bettina Schwarzer, Fritz-Haber-Institut
 * @copyright 12/2011
 *
 * Autocomplete Anlagen
 */

    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();
    // label = angezeigter ListenWert, val = Wert im Eingabefeld nach Klick
    $sql = "SELECT al_bez as label, al_bez as val, al_ID as id 
            FROM fhiiqm.Anlage
            WHERE al_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();
?>