Which is the equivalent of mysql_data_seek using pdo objects? Can you give me an example?
Thanks!
The usual answer is: do your data seek directly in the array PDOStatement::fetchAll
... But it is WRONG IF the query fetches a lot of data (!).
There are 2 real solutions,
1) if database permits use PDO::FETCH_ORI_ABS
or PDO::FETCH_ORI_REL
,
example,
$result = $sth->fetch(PDO::FETCH_ASSOC, PDO::FETCH_ORI_ABS, 973);
(EDIT) But, as commented by @ChoiZ, have a PDO-MySQL limitation: "MySQL does not support cursors" (outside stored programs) "and the driver cannot emulate them for you"... Try later or with MySQL's forks, like MariaDB.
2) use the database solution (a kind of pagination). Example:
SELECT a, b FROM table LIMIT 1, 973