[10501] PDOException in Connection.php line 687

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'index' at line 1

  1. $this->debug(false, '', $master);
  2. // 返回結果集
  3. return $this->getResult($pdo, $procedure);
  4. } catch (\PDOException $e) {
  5. if ($this->isBreak($e)) {
  6. return $this->close()->query($sql, $bind, $master, $pdo);
  7. }
  8. throw new PDOException($e, $this->config, $this->getLastsql());
  9. } catch (\Throwable $e) {
  10. if ($this->isBreak($e)) {
  11. return $this->close()->query($sql, $bind, $master, $pdo);
  12. }
  13. throw $e;
  14. } catch (\Exception $e) {
  15. if ($this->isBreak($e)) {
  16. return $this->close()->query($sql, $bind, $master, $pdo);

Call Stack

  1. in Connection.php line 687
  2. at Connection->query(' SELECT * from ( SEL...', [], false, false) in Query.php line 315
  3. at Query->query(' SELECT * from ( SEL...') in Index.php line 317
  4. at Index->news_info('index')
  5. at ReflectionMethod->invokeArgs(object(Index), ['index']) in Container.php line 395
  6. at Container->invokeReflectMethod(object(Index), object(ReflectionMethod), ['_c' => '1', 'id' => 'index']) in Module.php line 132
  7. at Module->think\route\dispatch\{closure}(object(Request), object(Closure), null)
  8. at call_user_func_array(object(Closure), [object(Request), object(Closure), null]) in Middleware.php line 185
  9. at Middleware->think\{closure}(object(Request))
  10. at call_user_func(object(Closure), object(Request)) in Middleware.php line 130
  11. at Middleware->dispatch(object(Request), 'controller') in Module.php line 137
  12. at Module->exec() in Dispatch.php line 168
  13. at Dispatch->run() in App.php line 432
  14. at App->think\{closure}(object(Request), object(Closure), null)
  15. at call_user_func_array(object(Closure), [object(Request), object(Closure), null]) in Middleware.php line 185
  16. at Middleware->think\{closure}(object(Request))
  17. at call_user_func(object(Closure), object(Request)) in Middleware.php line 130
  18. at Middleware->dispatch(object(Request)) in App.php line 435
  19. at App->run() in index.php line 21

Exception Datas

PDO Error Info
SQLSTATE 42000
Driver Error Code 1064
Driver Error Message You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'index' at line 1
Database Status
Error Code 10501
Error Message SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'index' at line 1
Error SQL SELECT * from ( SELECT @rank:=@rank+1 as rank,a.* from (( SELECT * FROM `xzd_article` WHERE `valid` = 1 AND ( concat(',',site,',') REGEXP ',27,|,5,' ) ORDER BY sort asc,publish_time desc,id asc )) a,(SELECT @rank:=0) b) a where 1 and id=index
Database Config
type mysql
hostname 127.0.0.1
database xinzhidi_four_xi
hostport 3306
dsn
params []
charset utf8
prefix
debug true
deploy 0
rw_separate false
master_num 1
slave_no
read_master false
fields_strict true
resultset_type array
auto_timestamp false
datetime_format Y-m-d H:i:s
sql_explain false
builder
query \think\db\Query
break_reconnect false
break_match_str []
xzd_redis_config { "hostname": "127.0.0.1", "hostport": "6379", "password": false, "database": 0 }

Environment Variables

GET Data
_c 1
POST Dataempty
Filesempty
Cookiesempty
Sessionempty
Server/Request Data
USER www
HOME /home/www
HTTP_ACCEPT */*
HTTP_HOST www.xinzhidi.cn
PATH_INFO
REDIRECT_STATUS 200
SERVER_NAME xinzhidi.four.xinzhidi.cn
SERVER_PORT 80
SERVER_ADDR 10.0.8.10
REMOTE_PORT 60624
REMOTE_ADDR 43.138.21.33
SERVER_SOFTWARE nginx/1.22.1
GATEWAY_INTERFACE CGI/1.1
REQUEST_SCHEME http
SERVER_PROTOCOL HTTP/1.1
DOCUMENT_ROOT /www/wwwroot/xinzhidi.four.xinzhidi.cn/xinzhidi_web/public
DOCUMENT_URI index.html
REQUEST_URI /index/index/news_info/id/index?_c=1
SCRIPT_NAME index.html
CONTENT_LENGTH
CONTENT_TYPE
REQUEST_METHOD GET
QUERY_STRING s=/index/index/news_info/id/index&_c=1
SCRIPT_FILENAME /www/wwwroot/xinzhidi.four.xinzhidi.cn/xinzhidi_web/publicindex.html
FCGI_ROLE RESPONDER
PHP_SELF index.html
REQUEST_TIME_FLOAT 1697135557.912
REQUEST_TIME 1697135557
Environment Variablesempty
ThinkPHP Constantsempty