简体   繁体   English

查询失败您的SQL语法有误。 检查与您的MariaDB服务器版本相对应的手册

[英]Query Failed You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version

http://localhost/project/activate.php?email=rakibchokder94@gmail.com&code=b98535103096dd0e8f59a5c6c92b9008 HTTP://localhost/project/activate.php email=rakibchokder94@gmail.com&code=b98535103096dd0e8f59a5c6c92b9008

Output Query Failed 输出查询失败

You have an error in your SQL syntax; 您的SQL语法有误; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''b98535103096dd0e8f59a5c6c92b9008'' at line 1 检查与您的MariaDB服务器版本相对应的手册以获取正确的语法,以在第1行的“ b98535103096dd0e8f59a5c6c92b9008”附近使用

    <?php
function clean($string){
    return htmlentities($string);
}

function redirect($location){
    return header("Location: {$location}");
}

function set_message($message){
    if(!empty($message)){
       $_SESSION['message'] =$message;  
    }
    else{
        $message="";
    }
}

function display_message(){
    if(isset($_SESSION['message'])){

        echo $_SESSION['message'];
        unset($_SESSION['message']);

    }
}



function activate_user(){
    if($_SERVER['REQUEST_METHOD']=="GET"){
        if(isset($_GET['email'])){
            $email=clean($_GET['email']);
            $validation_code = clean($_GET['code']);

            $sql = "SELECT id FROM users WHERE email='".escape($_GET['email'])."' AND validation_code'".escape($_GET['code'])."' ";
            $result=query($sql);
            confirm($result);

            if(row_count($result)==1){

                $sql2 = "UPDATE 'users' SET 'active' = 1, 'validation_code' = 0 WHERE 'email' = '".escape($email)."' AND 'validation_code' = '".escape($validation_code)."' ";
                $result2=query($sql2);
                confirm($result2);

                set_message("<p class='bg-success'>Your account has been activated</p>");
                redirect("login.php");
            }
            else{
                set_message("<p class='bg-danger'>Your account has not been activated</p>");
                redirect("login.php");
            }
        }
    }
}
?>

You have a typo in the query 您在查询中有错字

$sql = "SELECT id FROM users WHERE email='".escape($_GET['email'])."' AND validation_code'".escape($_GET['code'])."' ";

You're missing an equals sign 您缺少等号

AND validation_code='".escape($_GET['code'])."' ";
-------------------^

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 查询失败 您的 SQL 语法有错误; 检查与您的 MariaDB 服务器版本相对应的手册以获取正确的语法 - Query Failed You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax 查询失败!您的SQL语法有误; 检查与您的MySQL服务器版本相对应的手册 - Query Failed!You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version 您的SQL语法有错误;查看与MariaDB服务器版本对应的手册,以获取正确的语法 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use 您的SQL语法有误; 请查看与您的MariaDB服务器版本相对应的手册以获取正确的语法” - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax" 您的SQL语法有误; 检查与您的MariaDB服务器版本相对应的手册 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version 错误:您的SQL语法有错误; 检查与您的MariaDB服务器版本相对应的手册以获取在更新中使用的正确语法 - Error: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use in Update 发生数据库错误您的 SQL 语法有错误; 检查与您的 MariaDB 服务器版本相对应的手册以获取正确的语法 - A Database Error Occurred You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax 您的SQL语法有误; 检查与您的MariaDB服务器版本相对应的手册以使用nea的正确语法 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use nea 您的SQL语法有误; 检查与您的MariaDB服务器版本相对应的手册,以在第1行的&#39;1&#39;附近使用正确的语法 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '1' at line 1 您的SQL语法有误; 检查与您的MariaDB服务器版本相对应的手册以在第1行的&#39;)&#39;附近使用正确的语法 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')' at line 1
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM