您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

PDO 的游标为什么无效

2025/10/1 16:13:33发布52次查看
pdo 的游标为何无效?
本帖最后由 baidu_26094577 于 2015-02-27 14:53:25 编辑 $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. 
获取所请求的行从结果中光标当前位置的相对位置的设置
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product