select * from products where cid in () and status=1 order by p_id desc
执行错误: 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 status=1 order by p_id desc' at line 1
- /var/www/html/src/SpeedPHP/Drivers/mysql.php on line 62
57.
{
58.
$this->arrSql[] = $sql;
59.
if( $result = mysql_query($sql, $this->conn) ){
60.
return $result;
61.
}else{
62.
63.
spError("{$sql}<br />执行错误: " . mysql_error());
}
64.
}
65.
66.
/**
67.
* 返回影响行数
- /var/www/html/src/SpeedPHP/Drivers/mysql.php on line 26
21.
*
22.
* @param sql 执行的SQL语句
23.
*/
24.
public function getArray($sql)
25.
{
26.
27.
if( ! $result = $this->exec($sql) )return array();
if( ! mysql_num_rows($result) )return array();
28.
$rows = array();
29.
while($rows[] = mysql_fetch_array($result,MYSQL_ASSOC)){}
30.
mysql_free_result($result);
31.
array_pop($rows);
- /var/www/html/src/SpeedPHP/Core/spModel.php on line 208
203.
*
204.
* @param sql 字符串,需要进行查找的SQL语句
205.
*/
206.
public function findSql($sql)
207.
{
208.
209.
return $this->_db->getArray($sql);
}
210.
211.
/**
212.
* 执行SQL语句,相等于执行新增,修改,删除等操作。
213.
*
- /var/www/html/src/controller/main.php on line 125
120.
$cids = [];
121.
foreach ($datas as $k => $v) {
122.
$cids[] = $v['cid'];
123.
}
124.
$str = implode(',',$cids);
125.
126.
$this->products = spClass('lib_products')->findSql("select * from products where cid in ({$str}) and status=1 order by p_id desc");
}
127.
public function getproducts(){
128.
$this->cid = $cid = $this->spArgs('cid')? : 0;
129.
$products = spClass('lib_products')->findAll(array('cid'=>$cid,'status'=>1),'p_id desc',null);
130.
echo json_encode($products);
- /var/www/html/src/SpeedPHP/spFunctions.php on line 21
16.
if(!is_object($handle_controller) || !method_exists($handle_controller, $__action)){
17.
eval($GLOBALS['G_SP']["dispatcher_error"]);
18.
exit;
19.
}
20.
// 路由并执行用户代码
21.
22.
$handle_controller->$__action();
// 控制器程序运行完毕,进行模板的自动输出
23.
if(FALSE != $GLOBALS['G_SP']['view']['auto_display']){
24.
$__tplname = $__controller.$GLOBALS['G_SP']['view']['auto_display_sep'].
25.
$__action.$GLOBALS['G_SP']['view']['auto_display_suffix']; // 拼装模板路径
26.
$handle_controller->auto_display($__tplname);