Saturday, March 29, 2014

Query massacre

Wow! I got myself over the shock of facing another deprecated mysql_ function, but look at this construction:

for($i=0;$i<5;$i++){
$q[$i]=mysql_query("SELECT * FROM users LIMIT $i,1");
}

Uses a for loop to execute multiple queries selecting one line each instead of LIMIT 0,5. GENIUS.

No comments:

Post a Comment