Hello, I'm currently rewriting some code to speed it up, make it more portable, and more secure. I want to display a list of all members in a table, simple enough. However, the problem happens when I've got 300+ "active" users, my queries seem to be very slow when I'm not running my code locally. Here's the code:
function dispMembers() {
global $session;
$result = mysql_query("select * from ranks order by num desc");
$row = mysql_fetch_array($result);
$largest = $row['num'];
echo ("<center><p>Members</p><table border=1 width=50% id=table1 bordercolor=#000000 cellspacing=0>
<tr>
<td>Rank</td>
<td>Username</td>
<td>Email</td>
</tr>");
$i = 0;
for($i=$largest; $i>=1; $i--) {
$result = mysql_query("SELECT * FROM members WHERE rank = $i and disable != 1");
while($row = @mysql_fetch_array($result)) {
extract($row);
echo("<tr><td><img src=" . rankImg($rank) . "></td>
<td><a href=profile.php?PHPSESSID=$session&user=$username>$username</a></td>
<td><a href=mailto:$email>$email</a></td></tr>");
}
}
}
It basically looks for the newest row ($largest), and echos out all the info from 1 to $largest. Is there anyway I can speed this up? Is it possible to restrict which columns it will look up, because I only really need rank, username and email?
Thanks in advance.