Why is the PDO cursor invalid?

Source: Internet
Author: User
Why is the PDO cursor invalid?
$aa = $db->prepare('select * from user',array(PDO::ATTR_CURSOR => PDO::CURSOR_SCROLL));$aa ->execute();$aa->fetch();$aa->fetch();$a=$aa->fetch(PDO::FETCH_NUM, PDO::FETCH_ORI_NEXT);print_r($a);


Enabled cursor has been set in prepare;
The result is the third line instead of the last line;
The second parameter of all fetch tests is invalid;

Ask what the reason is. Isn't this a rollback? does the table need to be INNODB?
It is hard to understand the way it is written in the manual;
Asking for help... thinks;


Reply to discussion (solution)

Of course it is the record of the third line. take a closer look at the examples in the manual and the descriptions of functions.

FETCH_ORI_NEXT
Fetch the next row in the result set. Valid only for scrollable cursors.
Remove the result set of a row

FETCH_ORI_PRIOR
Fetch the previous row in the result set. Valid only for scrollable cursors.
Returns the result set of the first row.

FETCH_ORI_FIRST (integer)
Fetch the first row in the result set. Valid only for scrollable cursors.
Obtain the first row of the result set.

FETCH_ORI_LAST
Fetch the last row in the result set. Valid only for scrollable cursors.
Returns the result set of the last row.

FETCH_ORI_ABS
Fetch the requested row by row number from the result set. Valid only for scrollable cursors.
Obtain the number of requested rows from the result set

FETCH_ORI_REL
Fetch the requested row by relative position from the current position of the cursor in the result set. Valid only for scrollable cursors.
Obtains the relative position of the requested row from the result.

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.