メインコンテンツまでスキップ
Version: Fegg 5.x(開発版)

Pdo::setLimit

Set limit value

Description​

public self Pdo::setLimit( int $limit, [ int $offset = 0 ] )

Adds Limit offset, limit to a SELECT.

Arguments​

NameData typeDefaultRemarks
$limitintMaximum number of rows
$offsetint0Number of rows to skip

Example​

Controller
$db = new \Fegg\Database\Pdo();

// ... Order By post_date DESC Limit 20, 10 (rows 21 to 30)
$rows = $db->setOrder('post_date DESC')->setLimit(10, 20)->select('cms_news')->execute()->all();