PHPCMS黄页模块发布出现SQL错误的解决办法

by 北山 . 0 Comments

最近在用PHPCMS黄页系统时,发布有时候会出现下面的错误

MySQL Query : UPDATE `phpcms_category` SET `pitems`=`pitems`+1 WHERE `catid` IN ()

MySQL Error : 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 ‘)’ at line 1
MySQL Errno : 1064
Message : MySQL Query Error

研究了下,找到解决的办法,记录下

1、打开黄页yp内include文件夹下的yp_class.php文件
2、找到

 {
   $this->db->query(“UPDATE `$this->table_category` SET `pitems`=`pitems`+1 WHERE `catid` IN (“.$arr_catids.”)”);
  }
  elseif($this->model_type==’buy’)
  {
   $this->db->query(“UPDATE `$this->table_category` SET `items`=`items`+1 WHERE `catid` IN (“.$arr_catids.”)”);
  }

3、把上面对应代码换成:

  {
   $this->db->query(“UPDATE `$this->table_category` SET `pitems`=`pitems`+1 WHERE `catid`='”.$data[‘catid’].”‘”);
  }
  elseif($this->model_type==’buy’)
  {
   $this->db->query(“UPDATE `$this->table_category` SET `items`=`items`+1 WHERE `catid`='”.$data[‘catid’].”‘”);
  }

发表评论

电子邮件地址不会被公开。 必填项已用*标注