/*
* You will have noticed that we can iterate over the result set directly
* with foreach. This is because internally the PDO statement implements
* the SPL traversble iterator, thus giving all the benifits of using SPL.
*
* The greatest benifit of this is that SPL iterators know only one element
* at a time and thus large result sets become manageable without hogging
* memory.
*/
foreach ($dbh->query('select * from currency') as $row) {
echo '<option value="' . $row['ISO'] . '">';
echo $row['Arabic'] . "</option>\n";
}
echo '</select></p>';
// Close the databse connection
$dbh = null;
} catch(PDOException $e) {
echo $e->getMessage();
}
?>Total execution time is 0.0036840438842773 seconds
Amount of memory allocated to this script is 136704 bytes