// /dripend/systemSetup/gdrg/search_icd.php
require_once '../../../includes/db.php';
$search = $conn->real_escape_string($_GET['q']);
$sql = "SELECT code, description FROM icd10_dictionary WHERE code LIKE ? OR description LIKE ? LIMIT 20";
$stmt = $conn->prepare($sql);
$term = "%$search%";
$stmt->bind_param("ss", $term, $term);
$stmt->execute();
echo json_encode($stmt->get_result()->fetch_all(MYSQLI_ASSOC));