[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 'AND `id` <> ORDER BY `sort` ASC,`id` DESC LIMIT 6' 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 `sx_ca...', ['ThinkBind_1_' => [0, 1], 'ThinkBind_2_' => [1, 1], 'ThinkBind_3_' => [1, 1]], false, false) in Connection.php line 923
  3. at Connection->select(object(Query)) in Query.php line 3008
  4. at Query->select() in Cases.php line 34
  5. at Cases->getListsByWhere(['limit' => 6, 'addwhere' => [['type', '=', 1], ['style_id', '=', null], ['id', '<>', null]]]) in Cases.php line 187
  6. at Cases->detail()
  7. at ReflectionMethod->invokeArgs(object(Cases), []) in Container.php line 395
  8. at Container->invokeReflectMethod(object(Cases), object(ReflectionMethod), ['id' => '25', 'convert' => false]) in Module.php line 132
  9. at Module->think\route\dispatch\{closure}(object(Request), object(Closure), null)
  10. at call_user_func_array(object(Closure), [object(Request), object(Closure), null]) in Middleware.php line 185
  11. at Middleware->think\{closure}(object(Request))
  12. at call_user_func(object(Closure), object(Request)) in Middleware.php line 130
  13. at Middleware->dispatch(object(Request), 'controller') in Module.php line 137
  14. at Module->exec() in Dispatch.php line 168
  15. at Dispatch->run() in App.php line 432
  16. at App->think\{closure}(object(Request), object(Closure), null)
  17. at call_user_func_array(object(Closure), [object(Request), object(Closure), null]) in Middleware.php line 185
  18. at Middleware->think\{closure}(object(Request))
  19. at call_user_func(object(Closure), object(Request)) in Middleware.php line 130
  20. at Middleware->dispatch(object(Request)) in App.php line 435
  21. 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 'AND `id` <> ORDER BY `sort` ASC,`id` DESC LIMIT 6' 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 'AND `id` <> ORDER BY `sort` ASC,`id` DESC LIMIT 6' at line 1
Error SQL SELECT * FROM `sx_cases` WHERE `isdelete` = 0 AND `status` = 1 AND `type` = 1 AND `style_id` = AND `id` <> ORDER BY `sort` ASC,`id` DESC LIMIT 6
Database Config
type mysql
hostname 127.0.0.1
database daweis_com
hostport 3306
dsn
params []
charset utf8
prefix sx_
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 []

Environment Variables

GET Dataempty
POST Dataempty
Filesempty
Cookiesempty
Sessionempty
Server/Request Data
USER www
HOME /home/www
HTTP_HOST www.daweis.com
HTTP_REFERER http://daweis.com/casedetail/25
HTTP_USER_AGENT claudebot
HTTP_ACCEPT */*
PATH_INFO
REDIRECT_STATUS 200
SERVER_NAME daweis.com
SERVER_PORT 80
SERVER_ADDR 172.31.110.233
REMOTE_PORT 42274
REMOTE_ADDR 54.225.35.224
SERVER_SOFTWARE nginx/1.20.2
GATEWAY_INTERFACE CGI/1.1
REQUEST_SCHEME http
SERVER_PROTOCOL HTTP/1.1
DOCUMENT_ROOT /www/wwwroot/daweis.com/public
DOCUMENT_URI /index.php
REQUEST_URI /casedetail/25
SCRIPT_NAME /index.php
CONTENT_LENGTH
CONTENT_TYPE
REQUEST_METHOD GET
QUERY_STRING s=/casedetail/25
SCRIPT_FILENAME /www/wwwroot/daweis.com/public/index.php
FCGI_ROLE RESPONDER
PHP_SELF /index.php
REQUEST_TIME_FLOAT 1711652273.3573
REQUEST_TIME 1711652273
Environment Variablesempty
ThinkPHP Constants
MAX_MENU_LENGTH 3
MAX_SUB_MENU_LENGTH 5
MODULE_NAME cases
ACTION_NAME detail