<?php
// multiRecordsetItorator class // // This is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 2 of the License, or // (at your option) any later version. // // This is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // See <http://www.gnu.org/licenses/>.
$conn = new PDO('mysql:host=localhost;dbname=csproofing.coursestage.local', 'root', 'password');
$recordset1 = $conn->query("SELECT id, username FROM mdl_user where id IN (1,2,3,4,5,10, 11, 12) order by id DESC"); $recordset2 = $conn->query("SELECT id, firstname, lastname FROM mdl_user where id IN (1,3,6,7,9) order by id DESC");
$test = new multiPDOStatementIterator('id', multiPDOStatementIterator::DESC, $recordset1, $recordset2);
foreach ($test as $record) { var_dump($record); }
|