[10501] PDOException in Connection.php line 362

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) ) ORDER BY id desc LIMIT 1' at line 1

  1. // 参数绑定
  2. $this->bindValue($bind);
  3. // 执行查询
  4. $result = $this->PDOStatement->execute();
  5. // 调试结束
  6. $this->debug(false);
  7. $procedure = in_array(strtolower(substr(trim($sql), 0, 4)), ['call', 'exec']);
  8. return $this->getResult($class, $procedure);
  9. } catch (\PDOException $e) {
  10. throw new PDOException($e, $this->config, $this->queryStr);
  11. }
  12. }
  13. /**
  14. * 执行语句
  15. * @access public
  16. * @param string $sql sql指令
  17. * @param array $bind 参数绑定
  18. * @return int

Call Stack

  1. in Connection.php line 362
  2. at Connection->query('SELECT COUNT(*) AS t...', [], false, true) in Query.php line 191
  3. at Query->query('SELECT COUNT(*) AS t...', [], false, true) in Query.php line 2001
  4. at Query->find() in Query.php line 394
  5. at Query->value('COUNT(*) AS tp_count', 0) in Query.php line 492
  6. at Query->count() in Query.php line 1006
  7. at Query->paginate(8) in Article.php line 17
  8. at Article->getAllArticles('index') in Imglist.php line 10
  9. at Imglist->index()
  10. at ReflectionMethod->invokeArgs(object(Imglist), []) in App.php line 230
  11. at App::invokeMethod([object(Imglist), 'index']) in App.php line 395
  12. at App::module(['index', 'imglist', 'index'], ['app_namespace' => 'app', 'app_debug' => true, 'app_trace' => false, ...], null) in App.php line 138
  13. at App::run() in start.php line 18
  14. at require('/data/www/yxyweb/thi...') in index.php line 22

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) ) ORDER BY id desc LIMIT 1' 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) ) ORDER BY id desc LIMIT 1' at line 1
Error SQL
SELECT COUNT(*) AS tp_count FROM `yxy_article` WHERE ( cateid IN(1,2,index) ) ORDER BY id desc LIMIT 1
Database Config
type
mysql
hostname
127.0.0.1
database
yxyWeb
username
root
password
Cmm307646
hostport
dsn
params
[]
charset
utf8
prefix
yxy_
debug
true
deploy
0
rw_separate
false
master_num
1
slave_no
fields_strict
true
resultset_type
array
auto_timestamp
false
sql_explain
false
builder
query
\think\db\Query

Environment Variables

GET Dataempty
POST Dataempty
Filesempty
Cookiesempty
Sessionempty
Server/Request Data
USER
www
HOME
/home/www
FCGI_ROLE
RESPONDER
SCRIPT_FILENAME
/data/www/yxyweb/public/index.php
QUERY_STRING
s=//index/imglist/index/cateid/index.html
REQUEST_METHOD
GET
CONTENT_TYPE
CONTENT_LENGTH
SCRIPT_NAME
/index.php
REQUEST_URI
/index/imglist/index/cateid/index.html
DOCUMENT_URI
/index.php
DOCUMENT_ROOT
/data/www/yxyweb/public
SERVER_PROTOCOL
HTTP/1.1
REQUEST_SCHEME
http
GATEWAY_INTERFACE
CGI/1.1
SERVER_SOFTWARE
nginx/1.12.2
REMOTE_ADDR
154.219.154.246
REMOTE_PORT
20014
SERVER_ADDR
172.31.28.11
SERVER_PORT
80
SERVER_NAME
yixiangyong.com
REDIRECT_STATUS
200
PHP_ADMIN_VALUE
open_basedir=/data/www/:/tmp/:/proc/
HTTP_USER_AGENT
Mozilla/5.0+(compatible;+Baiduspider/2.0;++http://www.baidu.com/search/spider.html)
HTTP_HOST
www.yixiangyong.com
HTTP_ACCEPT
*/*
HTTP_ACCEPT_ENCODING
deflate, gzip
PHP_SELF
/index.php
REQUEST_TIME_FLOAT
1573230634.8036
REQUEST_TIME
1573230634
PATH_INFO
//index/imglist/index/cateid/index.html
Environment Variablesempty
ThinkPHP Constants
APP_PATH
/data/www/yxyweb/public/../application/
TPL
/data/www/yxyweb/public/../public/template/
THINK_VERSION
5.0.2
THINK_START_TIME
1573230634.8041
THINK_START_MEM
260424
EXT
.php
DS
/
THINK_PATH
/data/www/yxyweb/thinkphp/
LIB_PATH
/data/www/yxyweb/thinkphp/library/
CORE_PATH
/data/www/yxyweb/thinkphp/library/think/
TRAIT_PATH
/data/www/yxyweb/thinkphp/library/traits/
ROOT_PATH
/data/www/yxyweb/
EXTEND_PATH
/data/www/yxyweb/extend/
VENDOR_PATH
/data/www/yxyweb/vendor/
RUNTIME_PATH
/data/www/yxyweb/runtime/
LOG_PATH
/data/www/yxyweb/runtime/log/
CACHE_PATH
/data/www/yxyweb/runtime/cache/
TEMP_PATH
/data/www/yxyweb/runtime/temp/
CONF_PATH
/data/www/yxyweb/public/../application/
CONF_EXT
.php
ENV_PREFIX
PHP_
IS_CLI
false
IS_WIN
false