|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-07-03 16:13 UTC] uw@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 08:00:02 2025 UTC |
Description: ------------ I'm trying to use different types of cursor orientations. Even example from official manual does not work. Reproduce code: --------------- $dsn = 'mysql:dbname=...'; $dbh = new PDO($dsn, $user, $password); $sql = "SELECT * FROM genres WHERE 1 ORDER BY id"; $stmt = $dbh->prepare($sql, array(PDO::ATTR_CURSOR => PDO::CURSOR_SCROLL)); $stmt->execute(); $row = $stmt->fetch(PDO::FETCH_NUM, PDO::FETCH_ORI_LAST); do { $data = $row[0] . "\t" . $row[1] . "\t" . $row[2] . "\n"; print $data; } while ($row = $stmt->fetch(PDO::FETCH_NUM, PDO::FETCH_ORI_PRIOR)); $stmt = null; Expected result: ---------------- 3 Fighting 2 Arcade/Puzzle 1 Action/Adventure Actual result: -------------- 1 Action/Adventure 2 Arcade/Puzzle 3 Fighting