本文整理汇总了PHP中db_factory::factory方法的典型用法代码示例。如果您正苦于以下问题:PHP db_factory::factory方法的具体用法?PHP db_factory::factory怎么用?PHP db_factory::factory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类db_factory
的用法示例。
在下文中一共展示了db_factory::factory方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getpaginateddata
public function getpaginateddata($position)
{
$connection = db_factory::factory(DB_TYPE);
$sql = "SELECT id,name,message FROM PaginateDao ORDER BY id DESC LIMIT {$position} ," . ITEM_PER_PAGE;
$results = $connection->getArray($sql);
$this->populate($results, 'paginate');
}
示例2: getwithdata
public function getwithdata()
{
$connection = db_factory::factory(DB_TYPE);
$sql = "select * from userdao order by username";
$results = $connection->getArray($sql);
$this->populate($results, 'user');
}
示例3: index
public function index()
{
$connection = db_factory::factory(DB_TYPE);
$sql = "SELECT COUNT(*) as num FROM PaginateDao";
$result = $connection->getArray($sql);
$pages = ceil((int) $result[0]['num'] / ITEM_PER_PAGE);
return $pages;
}
示例4: deleteuser
public function deleteuser($user_id)
{
$connection = db_factory::factory(DB_TYPE);
$sql = "DELETE FROM {$this->table} WHERE id = {$user_id}";
if ($connection->execute($sql)) {
return "<h4>Delete Failed</h4>";
} else {
return "<h4>Delete Successful</h4> ";
}
}
示例5: update
protected function update()
{
$connection = db_factory::factory(DB_TYPE);
$sql = "update {$this->table} set ";
$updates = array();
foreach ($this->values as $key => $value) {
$updates[] = "`{$key}`='" . $connection->clean($value) . "'";
}
$sql .= implode(',', $updates);
$sql .= "where id={$this->id}";
$connection->execute($sql);
}