#1 manjinzi
public function getdata($lang = null) {$conditions = array();
if ($lang) {
$conditions['lang'] = $lang;
}
return $this->spCache(3600 * 24)->findAll($conditions, 'px DESC', null, null);
}
带个参数 没有问题,不带参数就会出错多了一个where,能不能改进下,我现在是这么做的,判断下$conditions 是否为空
if ($conditions) {
return $this->spCache(3600 * 24)->findAll($conditions, 'px DESC', null, null);
} else {
return $this->spCache(3600 * 24)->findAll(null, 'id DESC', null, null);
}
SELECT * FROM cp_lang WHERE ORDER BY px 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 'ORDER BY px DESC' at line 1
2011-04-06 10:55:57