Created
March 25, 2015 17:16
-
-
Save yohangdev/a29177575336fc143658 to your computer and use it in GitHub Desktop.
PHP Laravel PDO Fetch (Memory save)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$query = DB::table('users')->where('name', 'John'); //Pretend this is a huge data set | |
$statement = $query->getConnection()->getPdo()->prepare($query->toSql()); | |
$statement->execute($query->getBindings()); | |
while ($record = $statement->fetch(PDO::FETCH_ASSOC)) { | |
//Do whatever you want, one row at a time | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment