Files
chocomae/src/web/server/maestro/check_id.php
T
2018-08-22 17:25:07 +09:00

40 lines
777 B
PHP

<?php
header("Content-Type: application/json");
include "./../lib/send_reply_json.php";
include "./../setup/connect_db.php";
$maestro_name = $_POST["maestro_name"];
$maestro_id = get_maestro_id($maestro_name);
if($maestro_id !== null) {
set_error_code("registered_name");
set_error_message($maestro_name." : 이미 등록된 마에스트로 계정입니다.");
send_result_fail();
exit;
}
send_result_success();
exit;
function get_maestro_id($maestro_name) {
global $db_conn;
$query = "SELECT MaestroID FROM maestro WHERE Name=?";
$stmt = $db_conn->prepare($query);
$stmt->bind_param("s", $maestro_name);
$stmt->execute();
$stmt->bind_result($maestro_id);
// while($stmt->fetch()) {
// ;
// }
$stmt->fetch();
$stmt->close();
return $maestro_id;
}
?>