Why is the cursor for PDO invalid?

Source: Internet
Author: User
$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);p rint_r ($a);


An open cursor has been set in the prepare;
The result is the third row, not the last line;
The second parameter of all fetch is tested and is invalid;

Ask what is the reason, this is not rollback, need the table is InnoDB?
In accordance with the wording of the manual, but also not good use, it is puzzling;
Help in .... thinks;


Reply to discussion (solution)

The third line, of course, you take a closer look at the examples in the manual and the description of the function

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

Fetch_ori_prior
Fetch the previous row in the result set. Valid only for scrollable cursors.
Take the result set of the previous row

Fetch_ori_first (integer)
Fetch the first row in the result set. Valid only for scrollable cursors.
Take the first row in the result set

Fetch_ori_last
Fetch the last row in the result set. Valid only for scrollable cursors.
Take 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.
Gets the number of rows requested 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.
Gets the setting of the requested row from the relative position of the cursor's current position in 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.