dongtiao2105 2017-02-07 01:55
浏览 29

too long

I have a SQL query:

if($stmt = $connection->prepare("INSERT INTO users(login, passwd, logged, register, last_login) VALUES(:login, :passwd, FALSE, NOW(), NULL")) {
    $stmt->bindValue(':login', $login, PDO::PARAM_STR);
    $stmt->bindValue(':passwd', md5($passwd), PDO::PARAM_STR);
    $stmt->execute();
    $stmt->close();
} else {
    echo "query error <b>".$connection->error."</b><br>";
}

and it returns this error:

Connection 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 near ':login, :passwd, FALSE, NOW(), NULL' at line 1

How can I fix it?

I am using MariaDB on Linux Fedora.

  • 写回答

2条回答 默认 最新

  • dongpang1898 2017-02-07 02:06
    关注

    Missing end of brackets at VALUES()

    VALUES(:login, :passwd, FALSE, NOW(), NULL
    VALUES(:login, :passwd, FALSE, NOW(), NULL)
    
    评论

报告相同问题?