Programming horror

in #programming7 years ago

Today I got a code at work that was doing something like:

  for($i = 0; $i < count($students->fetchAll()); $i++) {
     $name = $students->fetchAll()[$i]['name'];
     $age = $students->fetchAll()[$i]['age'];
  ...  
}

fetchAll() hits the database. Kill me.

Sort:  

Great article!

Thanks for your good posts, I followed you! +UP

Congratulations @vmjoao! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 2 years!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Do not miss the last post from @steemitboard:

The Steem community has lost an epic member! Farewell @woflhart!
SteemitBoard - Witness Update
Do not miss the coming Rocky Mountain Steem Meetup and get a new community badge!
Vote for @Steemitboard as a witness to get one more award and increased upvotes!

Coin Marketplace

STEEM 0.28
TRX 0.12
JST 0.032
BTC 66739.81
ETH 3087.19
USDT 1.00
SBD 3.73