76 lines
1.9 KiB
PHP
76 lines
1.9 KiB
PHP
<?php
|
|
header("Content-Type: application/json");
|
|
|
|
include "./../lib/send_reply_json.php";
|
|
include "./../setup/connect_db.php";
|
|
|
|
$maestroName = $_POST["maestro_name"];
|
|
|
|
|
|
$maestroList = null;
|
|
if(strlen($maestroName) === 0)
|
|
$maestroList = get_maestro_list();
|
|
else
|
|
$maestroList = get_maestro_list_by_name($maestroName);
|
|
|
|
set_data("maestroList", $maestroList);
|
|
send_result_success();
|
|
exit;
|
|
|
|
|
|
|
|
function get_maestro_list() {
|
|
global $db_conn;
|
|
|
|
$query = "
|
|
SELECT MaestroID, Name, AccountType, AcceptClausesDateTime
|
|
FROM maestro
|
|
WHERE ActivateStatus=0
|
|
ORDER BY MaestroID DESC
|
|
";
|
|
$stmt = $db_conn->prepare($query);
|
|
// $stmt->bind_param("iii", $maestroID, $startNo, $endNo);
|
|
// $stmt->bind_param("ii", $maestroName, $startNo);
|
|
$stmt->execute();
|
|
$stmt->bind_result($maestroID, $name, $accountType, $acceptClausesDateTime);
|
|
|
|
$maestroList = array();
|
|
while($stmt->fetch()) {
|
|
$maestro["maestroID"] = $maestroID;
|
|
$maestro["maestroName"] = $name;
|
|
$maestro["accountType"] = $accountType;
|
|
$maestro["acceptClausesDateTime"] = $acceptClausesDateTime;
|
|
array_push($maestroList, $maestro);
|
|
}
|
|
|
|
return $maestroList;
|
|
}
|
|
|
|
function get_maestro_list_by_name($maestroName) {
|
|
global $db_conn;
|
|
|
|
$query = "
|
|
SELECT MaestroID, Name, AccountType, AcceptClausesDateTime
|
|
FROM maestro
|
|
WHERE Name LIKE CONCAT('%', ?, '%') AND ActivateStatus=0
|
|
ORDER BY MaestroID DESC
|
|
";
|
|
$stmt = $db_conn->prepare($query);
|
|
// $stmt->bind_param("iii", $maestroID, $startNo, $endNo);
|
|
$stmt->bind_param("s", $maestroName);
|
|
$stmt->execute();
|
|
$stmt->bind_result($maestroID, $name, $accountType, $acceptClausesDateTime);
|
|
|
|
$maestroList = array();
|
|
while($stmt->fetch()) {
|
|
$maestro["maestroID"] = $maestroID;
|
|
$maestro["maestroName"] = $name;
|
|
$maestro["accountType"] = $accountType;
|
|
$maestro["acceptClausesDateTime"] = $acceptClausesDateTime;
|
|
array_push($maestroList, $maestro);
|
|
}
|
|
|
|
return $maestroList;
|
|
}
|
|
|
|
?>
|