mirror of
https://github.com/codeguy/php-the-right-way.git
synced 2025-08-05 13:37:25 +02:00
Optimize database interaction code example
This commit is contained in:
@@ -33,7 +33,8 @@ function getAllFoos($db) {
|
||||
return $db->query('SELECT * FROM table');
|
||||
}
|
||||
|
||||
foreach (getAllFoos($db) as $row) {
|
||||
$results = getAllFoos($db);
|
||||
foreach ($resultss as $row) {
|
||||
echo "<li>".$row['field1']." - ".$row['field1']."</li>"; // BAD!!
|
||||
}
|
||||
{% endhighlight %}
|
||||
|
Reference in New Issue
Block a user