ID: 15143
Updated by: sander
Old Summary: Large loop doesn't work.
Reported By: [EMAIL PROTECTED]
Old Status: Open
Status: Feedback
Bug Type: Apache related
Operating System: Win 2K
PHP Version: 4.1.1
New Comment:

Can you simplify the code and track down the problem to only a few
lines of code?


Previous Comments:
------------------------------------------------------------------------

[2002-01-21 09:37:25] [EMAIL PROTECTED]

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>


------------------------------------------------------------------------



Edit this bug report at http://bugs.php.net/?id=15143&edit=1


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to