• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

PDO 的游标为何无效?

php 搞代码 4年前 (2022-01-23) 11次浏览 已收录 0个评论
文章目录[隐藏]
			$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

!本文来源gaodai.ma#com搞#代!码(网

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


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:PDO 的游标为何无效?

喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址