Skip to content

Instantly share code, notes, and snippets.

@annibuliful
Created December 11, 2016 07:23
Show Gist options
  • Save annibuliful/c691d9597fc5f8ade22d93e1f60ca304 to your computer and use it in GitHub Desktop.
Save annibuliful/c691d9597fc5f8ade22d93e1f60ca304 to your computer and use it in GitHub Desktop.
<?php
$servername = "localhost";
$username = "root";
$password = "12345678";
$dbname = "test1";
$user = $_GET['Us'];
$pass = $_GET['Ps'];
$email = $_GET['Em'];
$conn = new mysqli($servername, $username, $password,$dbname);
$sql = "SELECT * FROM register WHERE Username = '".$user."' OR Email = ".$email.";";
$exec = $conn->query($sql);
$fetch = $exec->fetch_assoc();
if($fetch != TRUE){
$sql = "INSERT INTO register(Username, Password,Email)
VALUES ('".$user."', '".$pass."', '".$email."')";
if ($conn->query($sql) === TRUE) {
echo"สมัครเรียบร้อย";
}
}else{
echo"มีชื่อนี้แล้ว";}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment