13 lines
438 B
PHP
13 lines
438 B
PHP
<?php
|
|
require_once 'db/config.php';
|
|
|
|
if (isset($_GET['term'])) {
|
|
$term = $_GET['term'];
|
|
$pdo = db();
|
|
$stmt = $pdo->prepare('SELECT id, patient_id, patient_name FROM patients WHERE patient_name LIKE :term OR patient_id LIKE :term LIMIT 10');
|
|
$stmt->execute(['term' => '%' . $term . '%']);
|
|
$patients = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
header('Content-Type: application/json');
|
|
echo json_encode($patients);
|
|
}
|
|
?>
|