本文整理汇总了PHP中Zend\Db\Adapter\AdapterInterface::createStatement方法的典型用法代码示例。如果您正苦于以下问题:PHP AdapterInterface::createStatement方法的具体用法?PHP AdapterInterface::createStatement怎么用?PHP AdapterInterface::createStatement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Db\Adapter\AdapterInterface
的用法示例。
在下文中一共展示了AdapterInterface::createStatement方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: UnsubscribeList
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;
}
示例2: getCategories
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);
}