10bet网址
MySQL PHP API
Download this Manual
PDF (US Ltr)- 2.4Mb
PDF (A4)- 2.4Mb


5.34.6TableSelect::limit

Copyright 1997-2022 the PHP Documentation Group.

  • TableSelect::limit

    Limit selected rows

Description

publicmysql_xdevapi\TableSelectmysql_xdevapi\TableSelect::limit(introws);

Sets the maximum number of records or documents to return.

Parameters

rows

The maximum number of records or documents.

Return Values

A TableSelect object.

Examples

Example 5.177mysql_xdevapi\TableSelect::limitexample

getSchema("addressbook"); $table = $schema->getTable("names"); $result = $table->select('name', 'age') ->limit(1) ->execute(); $row = $result->fetchAll(); print_r($row); ?>

The above example will output something similar to:

Array ( [0] => Array ( [name] => John [age] => 42 ) )