I write at least a billion PHP while loops a day. Does anybody know of any cool techniques for making the following code dynamic using PHP functions or objects?
$results = mysql_query("SELECT blah FROM blah_blah");
while ($row = mysql_fetch_array($results)) {
//execute statements here
}
As per @Bryan’s comment, you can do something like this as of PHP 5.3+:
(Needs additional error handling in case of MySQL failure etc.)