public function UnsubscribeList(AdapterInterface $adapter, $from = null, $to = null) { $sql = 'SELECT * FROM user_unsubscribes'; $array_data = array(); if (!empty($from) && !empty($to)) { $sql .= ' where created_at >= ? and created_at <= ?'; $array_data = array($from, $to); } $statement = $adapter->createStatement($sql, $array_data); $result = $statement->execute(); return $result; }
public function getCategories($categoryId = null) { $sql = 'SELECT * FROM blog.view_posts_categories'; if ($categoryId != null) { $sql .= ' WHERE id = :id LIMIT 1'; } $stmt = $this->dbAdapter->createStatement($sql); $params = array(); if ($categoryId != null) { $params['id'] = $categoryId; } $result = $stmt->execute($params); return iterator_to_array($result); }