public function getSubFolderTotal($parentId, $options = array()) { $where = empty($options['where']) ? '' : $options['where']; $where = formatWhere($where); $res = DB::$dbInstance->getRows("SELECT count(*) as num FROM folders WHERE parent_id=" . $parentId . $where); return $res[0]['num']; }
public function getNextPreviousFolder($fd_id, $where = '') { $where = formatWhere($where); $res = DB::$dbInstance->getRows("SELECT MAX(fd_id) as max_fd_id FROM folders"); $max_id = $res[0]['max_fd_id']; $rand_id = rand(0, $max_id - 3); $res = DB::$dbInstance->getRows("SELECT * FROM folders WHERE fd_id!={$fd_id} and fd_id>{$rand_id} {$where} limit 2"); $folders = $res ? $res : array(); return $folders; }