Files
praxis-creutzburg-web/inc/suchepatient.php
T
2026-03-24 14:45:06 +01:00

37 lines
1.1 KiB
PHP

<?php
/**
* @package Patientsuche
* @copyright Copyright (C) 2021 ctb-it.de Inc. All rights reserved.
*
*/
include("config.inc.php");
/* retrieve the search term that autocomplete sends */
$term = trim(strip_tags($_GET['term']));
$a_json = array();
$a_json_row = array();
$sql = 'SELECT * FROM persons WHERE vorname LIKE "%' . $term . '%" OR nachname LIKE "%' . $term . '%" OR email LIKE "%' . $term . '%" OR tele LIKE "%' . $term . '%" ORDER BY nachname, vorname ';
foreach ($pdo->query($sql) as $row) {
$userid = stripslashes($row['person_id']);
$name = stripslashes($row['nachname']);
$vorname = stripslashes($row['vorname']);
$geburtstag = stripslashes($row['geburtstag']);
$email = htmlentities(stripslashes($row['email']));
$tele = htmlentities(stripslashes($row['tele']));
$a_json_row["id"] = $userid;
$a_json_row["value"] = $vorname.' '.$name.' - '.$geburtstag.' - '.$email.' - '.$tele;
$a_json_row["label"] = $vorname.' '.$name.' - '.$geburtstag.' - '.$email.' - '.$tele;
array_push($a_json, $a_json_row);
}
// jQuery wants JSON data
echo json_encode($a_json);
?>