php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49017 PDO::FETCH_ORI_REL not working
Submitted: 2009-07-22 14:25 UTC Modified: 2009-09-22 21:11 UTC
Votes:3
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: farkasmate_ at freemail dot hu Assigned:
Status: Not a bug Package: PDO related
PHP Version: 5.3.0 OS: win XP sp2
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: farkasmate_ at freemail dot hu
New email:
PHP Version: OS:

 

 [2009-07-22 14:25 UTC] farkasmate_ at freemail dot hu
Description:
------------
pdo mysql error.
PDO::FETCH_ORI_REL not working

sql result about 1000 rows.
I need to catch 555. row item but i get always first row (0.) of result.


Reproduce code:
---------------
$this->db_conn = new PDO("mysql:host=$db;dbname=mysql;EnableScrollableCursors=1",$db_username,$db_password);//connect mysql
$sql = "select * from tablename";
$this->db_conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT);
//$stmt = $this->db_conn->query($sql) or die("ERROR: " . implode(":", $this->db_conn->errorInfo()));
$stmt = $this->db_conn->prepare($sql,  array( PDO::ATTR_CURSOR => PDO::CURSOR_SCROLL )	);
$stmt->execute();
$search_row = 555;
$row = $stmt->fetch(PDO::FETCH_NUM , PDO::FETCH_ORI_REL, $search_row );
var_dump($row);

Expected result:
----------------
catch 555. row

Actual result:
--------------
catch first row


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-09-22 21:11 UTC] sjoerd@php.net
Thank you for your bug report.

Unfortunately, MySQL does not support scrollable cursors.

See also:
Bug #39310 PDO Scrolling cursors not available for Sqlite and don't work for Mysql
Bug #34625 Scrollable cursor doesn't work with MySQL
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 14 03:01:26 2024 UTC