You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
1107012776
changed the title
PHP PDO connects to MySQL using PDO:: CURSOR_ Invalid SCROLL cursor, unable to scroll to get the desired row
PHP PDO connects to MySQL using PDO:: CURSOR_ SCROLL cursor, unable to scroll to get the desired row
Oct 12, 2022
PDO_MySQL does not support scrolling cursors (actually, it doesn't support cursors at all), and to my knowledge, MySQL does not support scrolling cursors, so this will not be implemented for PDO. However, we need to document this.
PHP5.6.25
Ugh. I suggest you upgrade to PHP 8 as soon as possible.
cmb69
changed the title
PHP PDO connects to MySQL using PDO:: CURSOR_ SCROLL cursor, unable to scroll to get the desired row
PDO_MySQL does not support cursors
Oct 12, 2022
I thought PDO_MySQL supports forward-only cursors. Anyway, cursors in MySQL are pretty useless as it doesn't support scrollable cursors. We should probably mention this somewhere, but I don't know where. Maybe here? https://www.php.net/manual/en/ref.pdo-mysql.php
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:
What did I do wrong?
PHP Version
PHP5.6.25
Operating System
window7
The text was updated successfully, but these errors were encountered: