WeChatHelper
WeChatHelper copied to clipboard
新增数据,数据库报错
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 '3' at line 1 Typecho_Db_Query_Exception: 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 '3' at line 1 in /var/www/blog/var/Typecho/Db/Adapter/Pdo.php:105 Stack trace: #0 /var/www/blog/var/Typecho/Db.php(368): Typecho_Db_Adapter_Pdo->query('3', Object(PDO), 1, 'SELECT', NULL) #1 /var/www/blog/usr/plugins/WeChatHelper/Widget/CustomReply.php(209): Typecho_Db->query('3') #2 /var/www/blog/usr/plugins/WeChatHelper/Widget/CustomReply.php(313): WeChatHelper_Widget_CustomReply->insertCustomReply() #3 /var/www/blog/usr/plugins/WeChatHelper/Action.php(79): WeChatHelper_Widget_CustomReply->action() #4 /var/www/blog/var/Widget/Do.php(82): WeChatHelper_Action->action() #5 /var/www/blog/var/Typecho/Widget.php(221): Widget_Do->execute() #6 /var/www/blog/var/Typecho/Router.php(135): Typecho_Widget::widget('Widget_Do', NULL, Array) #7 /var/www/blog/index.php(23): Typecho_Router::dispatch() #8 {main}
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 '3' at line 1 Typecho_Db_Query_Exception: 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 '3' at line 1 in /var/www/blog/var/Typecho/Db/Adapter/Pdo.php:105 Stack trace: #0 /var/www/blog/var/Typecho/Db.php(368): Typecho_Db_Adapter_Pdo->query('3', Object(PDO), 1, 'SELECT', NULL) #1 /var/www/blog/usr/plugins/WeChatHelper/Widget/CustomReply.php(209): Typecho_Db->query('3') #2 /var/www/blog/usr/plugins/WeChatHelper/Widget/CustomReply.php(313): WeChatHelper_Widget_CustomReply->insertCustomReply() #3 /var/www/blog/usr/plugins/WeChatHelper/Action.php(79): WeChatHelper_Widget_CustomReply->action() #4 /var/www/blog/var/Widget/Do.php(82): WeChatHelper_Action->action() #5 /var/www/blog/var/Typecho/Widget.php(221): Widget_Do->execute() #6 /var/www/blog/var/Typecho/Router.php(135): Typecho_Widget::widget('Widget_Do', NULL, Array) #7 /var/www/blog/index.php(23): Typecho_Router::dispatch() #8 {main}
把WeChatHelper/Widget/CustomReply.php
的第208行的
$customReply['rid'] = $this->db->query($this->insert($customReply));
修改为
$customReply['rid'] = $this->db->query((int)($this->insert($customReply)));
类型转换一下
SQLSTATE [42000]:语法错误或访问冲突:1064 SQL语法中有错误; 检查与MySQL服务器版本对应的手册,以便在第1行的“3”附近使用正确的语法 Typecho_Db_Query_Exception:SQLSTATE [42000]:语法错误或访问冲突:1064 SQL语法中有错误; 查看与MySQL服务器版本对应的手册,以便在/var/www/blog/var/Typecho/Db/Adapter/Pdo.php:105第1行的'3'附近使用正确的语法。 堆栈跟踪: #0 / var / www / blog / var / Typecho / Db.php(368):Typecho_Db_Adapter_Pdo-> query('3',Object(PDO),1,'SELECT',NULL) #1 / var / www / blog / usr / plugins / WeChatHelper / Widget / CustomReply.php(209):Typecho_Db-> query('3') #2/var/www/blog/usr/plugins/WeChatHelper/Widget/CustomReply.php(313):WeChatHelper_Widget_CustomReply-> insertCustomReply() #3 /var/www/blog/usr/plugins/WeChatHelper/Action.php(79): WeChatHelper_Widget_CustomReply-> action() #4 /var/www/blog/var/Widget/Do.php(82):WeChatHelper_Action-> action() #5 /var/www/blog/var/Typecho/Widget.php(221 ):Widget_Do-> execute() #6 /var/www/blog/var/Typecho/Router.php(135):Typecho_Widget :: widget('Widget_Do',NULL,Array) #7 / var / www / blog / index.php(23):Typecho_Router :: dispatch() #8 {main}
把
WeChatHelper/Widget/CustomReply.php
的第208行的$customReply['rid'] = $this->db->query($this->insert($customReply));
修改为
$customReply['rid'] = $this->db->query((int)($this->insert($customReply)));
类型转换一下
自定义菜单那里也需要转换一下类型
WeChatHelper/Widget/Menus.php第273行
$menu['mid'] = $this->db->query($this->insert($menu));
修改为
$menu['mid'] = $this->db->query((int)($this->insert($menu)));