"fix for postgres problem reported by Hertell <nabble.com-at-hertell.com>, sql error when you filter by a category with sub-cats"

This commit is contained in:
Ralf Becker 2007-12-13 16:06:41 +00:00
parent cdb39b2444
commit 1d7510f85e

View File

@ -248,7 +248,7 @@ class socal
} }
array_walk($cats,create_function('&$val,$key','$val = (int) $val;')); array_walk($cats,create_function('&$val,$key','$val = (int) $val;'));
$sql = '(cal_category'.(count($cats) > 1 ? ' IN ('.implode(',',$cats).')' : '='.$this->db->quote((int)$cat_id)); $sql = '(cal_category'.(count($cats) > 1 ? " IN ('".implode("','",$cats)."')" : '='.$this->db->quote((int)$cat_id));
foreach($cats as $cat) foreach($cats as $cat)
{ {
$sql .= ' OR '.$this->db->concat("','",'cal_category',"','").' LIKE '.$this->db->quote('%,'.$cat.',%'); $sql .= ' OR '.$this->db->concat("','",'cal_category',"','").' LIKE '.$this->db->quote('%,'.$cat.',%');