我希望有人能够发现我不是的东西,因为在重新编写一些CMS个人项目之前我没有这个bug,但是我不知道我做错了什么这段代码之前曾经工作过
我的数据库连接是单例类
private function __construct()
{
try {
$params = [
PDO::ATTR_EMULATE_PREPARES => false, // turn off emulation mode for "real" prepared statements
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, //turn on errors in the form of exceptions
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, //make the default fetch be an associative array
];
self::$_dbh = @new PDO(
Config::DB_DRIVER . ':host=' . Config::DB_HOST . ';dbname=' . Config::DB_NAME . ';charset=' . Config::DB_CHARSET,
Config::DB_USER,
Config::DB_PASSWORD,
/* PDO options */
$params
);
} catch (PDOException $e) {
// If we can't established a database connection return and error
DBWrapper::fatal("
An error occurred while connecting to the database " .
Config::DB_NAME . "The error reported by the server was:" . $e->getMessage()
);
}
return self::$_dbh;
}
抛出此错误 未捕获的异常:“ PDOException”
消息:'SQLSTATE [42000]:语法错误或访问冲突:1064您的SQL语法有错误;检查与您的MariaDB服务器版本相对应的手册以获取在'?附近使用的正确语法。 LIMIT?,?'在第一行'
我的查询 string(68)“ SELECT * FROM images ORDER BY:orderby:order LIMIT:offset,:limit” 我正进入(状态 ??而不是名称占位符