[php-src] Issue #9726: PHP PDO connects to MySQL using PDO:: CURSOR_ Invalid SCROLL cursor, unable to scroll to get the desired row
| From: | 1107012776 | Date: | Wed, 12 Oct 2022 03:37:26 +0000 |
| Subject: | [php-src] Issue #9726: PHP PDO connects to MySQL using PDO:: CURSOR_ Invalid SCROLL cursor, unable to scroll to get the desired row | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-242579@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/9726
Author: 1107012776
### Description
For example, I have a table with two fields: id and value. I inserted nearly 100k rows into this
table.
I want to use the scrollable cursor. I wrote the following code:
```
$sql = 'SELECT id FROM cursor_ test;';
$stmt = $dbh->prepare($sql, array(PDO::ATTR_CURSOR => PDO::CURSOR_SCROLL));
$stmt ->Execute ();
$row = $stmt->fetch(PDO::FETCH_ASSOC, PDO::FETCH_ORI_ABS, 3);
var_ dump($row['id']); // 1, the expected value is 3
```
What did I do wrong?
### PHP Version
PHP5.6.25
### Operating System
window7