您的SQL语法有错误;查看与您的MariaDB服务器版本相对应的手册,以获取在Near附近使用的正确语法
<?php
include 'includes/conn.php';
if (isset($_POST['reg'])) {
# code...
$username = mysqli_real_escape_string($conn,$_POST['username']);
$role = mysqli_real_escape_string($conn,$_POST['role']);
$email = mysqli_real_escape_string($conn,$_POST['email']);
$pass = mysqli_real_escape_string($conn,$_POST['password']);
if (strlen($pass)<8) {
# code...
echo "
<script>
alert('Password Should Be Minimum 8 Characters!')
</script>
";
exit();
}
$check_email = "SELECT * FROM users WHERE email='$email'";
$run_email = mysqli_query($conn,$check_email);
$check = mysqli_num_rows($run_email);
if ($check==1) {
# code...
echo "
<script>
alert('Email Is Already Exist Try Another')
</script>
";
}
$insert = "INSERT INTO users('username', 'role', 'email', 'pass') VALUES ($username,$role,$email,$pass)";
if ($conn->query($insert) === TRUE) {
echo "<script>alert(Your Account Has Been Created Successfully!)</script>";
} else {
echo "<script>alert(Oops! Registration Failed,Please Try Again)</script>" . $insert . "<br>" . $conn->error;
}
}
?>