Igor Timoshenko
Igor Timoshenko

Reputation: 1011

PHP PDO MySQL scrollable cursor doesn't work

For instance, I have a table with two fields: id, value. I've inserted almost 100k rows in this table.

I want to use scrollable cursor. I wrote the following code:

<?php
...
$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, expected value is 3

What am I doing wrong?

Upvotes: 4

Views: 5383

Answers (1)

Related Questions