本文整理匯總了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);
}