You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

24 lines
629 B

<?php
// include "header_nomenu.php";
require_once dirname(__FILE__)."/database.php";
if ($_SERVER["REQUEST_METHOD"] == "GET") {
switch ($_GET["type"]) {
case "facilityno":
$stmt = $link->prepare("SELECT facilityno, address FROM facility
WHERE facilityno LIKE CONCAT(?, '%') ORDER BY facilityno ASC LIMIT 0 , ?");
// 此處僅有字串格式term
$stmt->bind_param("si", ...[$_GET["term"], $_GET["rn"]]);
$stmt->execute();
$datas = $stmt->get_result()->fetch_all(MYSQLI_ASSOC);
break;
}
}
die(json_encode(array(
"count" => count($datas),
"data" => $datas
)));
exit;
?>