Last active
March 18, 2019 06:51
-
-
Save ElectApp/937c35a7defccfa7d2a58e853d24ae7e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Thank SQL: https://www.w3schools.com/sql/sql_delete.asp | |
// https://www.tutorialspoint.com/mysqli/mysqli_delete_query.htm | |
$servername = "localhost"; //ใช้ localhost กรณี server อยู่บน online | |
$username = "พิมพ์ที่นี่"; //username ของ DirectAdmin | |
$password = "พิมพ์ที่นี่"; //password ของ DirectAdmin | |
$dbname = "test"; //ชื่อ database | |
// Create connection | |
$conn = new mysqli($servername, $username, $password, $dbname); | |
// Check connection | |
if ($conn->connect_error) { | |
die("Connection failed: " . $conn->connect_error); | |
} | |
//Get data from app | |
$userId = $_POST['userId']; | |
//Filter on DB | |
$sql = "DELETE FROM user_login_test WHERE id='$userId'"; | |
//Check result | |
if ($conn->query($sql) === TRUE) { | |
echo "Delete successfully"; | |
} else { | |
echo "Error: " . $sql . "<br>" . $conn->error; | |
} | |
$conn->close(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment