Fetching all rows as Object with pdo php -
i know function fetchobject (http://www.php.net/manual/en/pdostatement.fetchobject.php) gives me next row object of specified class, want rows object of specified class, pdo has function or have manually???
thanks!!
you looking pdostatement::fetchall
:
pdostatement::fetchall
— returns array containing of result set rows
example usage:
$arr = $stmt->fetchall(pdo::fetch_class, $class_name, $constructor_args);
if not need of objects in single array, find iterating through rows work well:
while ($obj = $stmt->fetchobject($class_name, $constructor_args)) { // process $obj }
Comments
Post a Comment