I am trying to limit the number of results that will be displayed to 100 rows if the search returns anything greater than 100 rows.
Of course, if the search returns anything less than 100 rows, I want to display all results.
Is there a more efficient way to do this? I don't want to call mysql_fetch_assoc() 100 times as I currently am on line 3.
What are the pros and cons of calling mysql_fetch_assoc() several times?
Does this eat up a lot of memory and processing power?
// Limit display to 100 listings.
// * Loop stops at 99 due to array position 0
1 if($total_found > 100){
2 for ($i = 0; $i <= 99; $i++){
3 $row = mysql_fetch_assoc($rs);
4 $uids[] = $row["uid"];
5 }
6 }else{
7 // If search returned less than 100, loop through entire recordset.
8 $row = mysql_fetch_assoc($rs);
9 do{
10 $uids[] = $row["uid"];
11 } while ($row = mysql_fetch_assoc($rs));
12 }
Thanx in advance...
Gadnium