Pdostatement::fetch

Source: Internet
Author: User

Description

pdostatement::fetch- Gets the next row from a result set related to a Pdostatement object. fetch_styleparameter determines how the POD returns rows.

Parameters fetch_style

Controls how the next row is returned to the caller. This value must be one of the pdo::fetch_* series constants, which defaults to pdo::attr_default_fetch_mode (default = Pdo::fetch_both ).

    • pdo::fetch_both(default): Returns an array that is indexed as a result set column name and a column number starting with 0

    • PDO::FETCH_ASSOC: Returns an array that is indexed as a result set column name

    • Pdo::fetch_num: Returns an array whose index is a 0-based result set column number

    • pdo::fetch_obj: Returns an anonymous object with a property name corresponding to the result set column name

    • pdo::fetch_bound: Returns TRUE and assigns the column values in the result set to the PHP variable bound to the Pdostatement::bindcolumn () method.

    • Pdo::fetch_class: Returns a new instance of the request class that maps the column names in the result set to the corresponding property names in the class. If fetch_style Pdo::fetch_classtype is included (for example:pdo::fetch_class | Pdo::fetch_classtype), the class name is determined by the value of the first column

    • pdo::fetch_into: Updating an instance of a requested class that already exists, mapping columns in the result set to properties named in the class

    • pdo::fetch_lazy: Using pdo::fetch_both and pdo::fetch_objtogether to create object variable names for access

Cursor_orientation

For a scrollable cursor represented by a Pdostatement object, this value determines which row will be returned to the caller. This value must be one of the pdo::fetch_ori_* series constants, and the default is Pdo::fetch_ori_next. For a Pdostatement object to use a scrollable cursor, you must preprocess the SQL statement with PDO::p Repare () and set the pdo::attr_cursor property to Pdo::cursor_scroll .

offset

For a scrollable cursor represented by a Pdostatement object with the cursor_orientation parameter set to pdo::fetch_ori_abs , this value specifies the absolute line number in the result set that you want to get the row.

For a scrollable cursor represented by a Pdostatement object that is set to Pdo::fetch_ori_rel for a cursor_orientation parameter, this value specifies that the row is to be fetched relative to the calling Position of the cursor before pdostatement::fetch ()

return value

The value returned when this function (method) succeeds depends on the fetch type. In all cases, the failure is returned FALSE .

Pdostatement::fetch

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.