|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-01-21 09:37 UTC] bkirk at uss dot com
This code doesn't seem to work with more than 20 people. I had it working great with 12 and then I added all 61 and the page just sits there and doesn't load. On IE or Netscape so it is the Apache or PHP. I am using the php.exe in apache not the module. I couldn't get the module to work correctly. I am using the latest stable versions of apache, mysql, and php. I also am using the mysql-nt-max. I don't think it is a problem with mysql cause I had a simular problem with a calendar program, yet when I didn't have tables (loop in a loop, just listed it straight out) it worked fine.
When I eliminate the tables in this program I get up to about line 20 before it just hangs forever. I waited about 3 hours to see if it loaded and it never stops trying.
<html>
<head>
<title>Football Playoff Picks Standings</title>
</head>
<body bgcolor=#ffffff>
<?php
$select="select a.nickname, round(sum(pow(2,a.round+1))),sum(1) from user_picks a, actual_wins b where a.round=b.round and a.division=b.division and a.winner=b.winner group by nickname order by 2 desc, 1 desc";
$select_tot="select sum(1) from actual_wins";
mysql_connect("localhost","root","Ushouldn'tBhere");
$result = mysql_db_query("football",$select);
$result_tot = mysql_db_query("football",$select_tot);
$row_tot = mysql_fetch_array($result_tot);
echo "<center><table border=1>";
echo "<tr><td></td><th><font size=+2>Place</font></th><th><font size=+2>Nickname</font></th><th><font size=+2>Points</font></th><th><font size=+2>Percentage</font></th></tr>";
$cnt = 1;
while($row = mysql_fetch_array($result)) {
$select="select winner from user_picks where round=3 and nickname='".$row["nickname"]."'";
$result2 = mysql_db_query("football",$select);
$row2 = mysql_fetch_array($result2);
$nickname = urlencode($row["nickname"]);
echo "<tr><td><center><img src=\"images/icons/".$row2["winner"].".gif\"></center></td>";
echo "<td><font size=+1><center>".$cnt."</center></font></td>";
echo "<td><font size=+1><center><a href=\"picks.php?nickname=".$nickname."\">".$row["nickname"]."</a></center></font></td>";
echo "<td align=right><font size=+1>".$row[1]."</font></td>";
$percentage=round($row[2]/$row_tot[0]*100);
echo "<td align=right><font size=+1>".$percentage." %</font></td></tr>";
mysql_free_result($result2);
$cnt++;
}
echo "</table></center>";
mysql_free_result($result);
?>
</body>
</html>
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 04:00:01 2025 UTC |
The selects in a loop is what does it. If I remove the select statement it seems to work fine in this program. Is there some kind of limit to how many selects on php page can handle? or am I not releasing the sql functions correctly? I also notice that everytime I have a page loading I see a new process for php.exe in the process tab under task manager. while($row = mysql_fetch_array($result)) { $select="select winner from user_picks where round=3 and nickname='".$row["nickname"]."'"; $result2 = mysql_db_query("football",$select); $row2 = mysql_fetch_array($result2); $nickname = urlencode($row["nickname"]); echo "<tr><td><center><img src=\"images/icons/".$row2["winner"].".gif\"></center></td>"; echo "<td><font size=+1><center>".$cnt."</center></font></td>"; echo "<td><font size=+1><center><a href=\"picks.php?nickname=".$nickname."\">".$row["nickname"]."</a></center></font></td>"; echo "<td align=right><font size=+1>".$row[1]."</font></td>"; $percentage=round($row[2]/$row_tot[0]*100); echo "<td align=right><font size=+1>".$percentage."%</font></td></tr>"; mysql_free_result($result2); $cnt++; }