php pdo 游标,PDO 的游标为何无效?

$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);

prepare中已经设置了开启游标;

结果是第三行,而不是最后一行;

测试了所有的fetch第二个参数,均无效;

求问这是什么原因,这个又不是回滚,需要表是INNODB吗?

按照手册上的写法,也不好用,很是费解;

求助中....thinks;

回复讨论(解决方案)

当然是第三行记录啦,你仔细看看手册上的例子以及函数的说明

FETCH_ORI_NEXT

Fetch the next row in the result set. Valid only for scrollable cursors.

取下一行的结果集

FETCH_ORI_PRIOR

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

取前一行的结果集

FETCH_ORI_FIRST (integer)

Fetch the first row in the result set. Valid only for scrollable cursors.

取结果集中的第一行

FETCH_ORI_LAST

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

取最后一行的结果集

FETCH_ORI_ABS

Fetch the requested row by row number from the result set. Valid only for scrollable cursors.

获取所请求的行数从结果集

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.

获取所请求的行从结果中光标当前位置的相对位置的设置

本文原创发布php中文网,转载请注明出处,感谢您的尊重!

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值