PHP code example of antevenio / pdo-mysql-select-iterator
1. Go to this page and download the library: Download antevenio/pdo-mysql-select-iterator library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
antevenio / pdo-mysql-select-iterator example snippets
$pdo = new PDO('mysql:host=localhost;dbname=kidsshouting', 'myuser', 'mypass');
$iterator = (new \PdoMysqlSelectIterator\Factory())
->create($pdo, "select a,b from tbl order by a", 1000);
// Get a total row count from the query if needed
$total = count($iterator);
foreach ($iterator as $item) {
// Do your stuff with $item
}