faqts : Computers : Programming : Languages : PHP

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

6 of 24 people (25%) answered Yes
Recently 1 of 10 people (10%) answered Yes

Entry

Simple PHP/MySQL page, all page data is displayed... but page won't stop loading- why?

Nov 28th, 2008 00:15
healthy man, dman, Matthew Wilkinson, Standard P,


You have probably done what I have done many times and created an
infinite loop. Here is an example of one way to create one:
$n = 1;
while ($n <= mysql_num_rows($result))
        {
        list($var1, $var2, $var3) = mysql_fetch_row($result);
        echo $var1 . $var2 . $var3;
        }
This could easily be fixed by adding $n++; before the closing bracket,
or using a for loop:
for ($n = 1; $n <= mysql_num_rows($result); $n++)
        {
        list($var1, $var2, $var3) = mysql_fetch_row($result);
        echo $var1 . $var2 . $var3;
        }
http://www.healthdothealth.com
http://www.healthxhealth.com
http://www.mesotheliomainmesothelioma.com
http://www.healthfirewall.com
http://www.flathealth.com
http://www.healthbodyguard.com