|
|
|
mysqli_prepare เป็น mysql ไม่เอา prepare เปลี่ยนส่วนไหนบ้างครับ |
|
|
|
|
|
|
|
Code (PHP)
<?php
$con = mysqli_connect("good_game", "user", "abcd1234", "data");
$username = $_POST["username"];
$password = $_POST["password"];
$statement = mysqli_prepare($con, "SELECT * FROM user WHERE username = ? AND password = ?");
mysqli_stmt_bind_param($statement, "ss", $username, $password);
mysqli_stmt_execute($statement);
mysqli_stmt_store_result($statement);
mysqli_stmt_bind_result($statement, $userID, $name, $age, $username, $password);
$response = array();
$response["success"] = false;
while(mysqli_stmt_fetch($statement)){
$response["success"] = true;
$response["name"] = $name;
$response["age"] = $age;
$response["username"] = $username;
$response["password"] = $password;
}
echo json_encode($response);
?>
Tag : PHP, MySQL, HTML
|
|
|
|
|
|
Date :
2017-07-03 13:17:35 |
By :
mininova |
View :
673 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 04
|