public static function GetImages($db, $options = array(), $databaseColumn, $table) { //initialize the otions $defaults = array($databaseColumn => array()); foreach ($defaults as $k => $v) { $options[$k] = array_key_exists($k, $options) ? $options[$k] : $v; } $select = $db->select(); $select->from(array('i' => $table), array('i.*')); //filter results on specified post ids (if any) if (count($options[$databaseColumn]) > 0) { $select->where('i.' . $databaseColumn . ' in (?)', $options[$databaseColumn]); } if (!empty($options['limit'])) { $select->limit($options['limit']); } else { //$select->limit(12); } $select->order('i.ranking'); echo "select is: " . $select . "<br />"; $data = $db->fetchAll($select); $images = parent::buildMultiple($db, __CLASS__, $data); return $images; }