1. Home
  2. Computing & Technology
  3. PHP / MySQL

My PHP page never stops loading!

By Angela Bradley, About.com

Question: My PHP page never stops loading!

The problem is, your page never stops loading. Sometimes it keeps kicking back data as your page grows to extreme lengths, while other times it just appears to be loading forever but nothing ever actually happens. What went wrong?

Answer: Most often the problem is caused by loops in your PHP. One common mistake is to forget to actually ++ add to the counter at the end of a loop, so your loop will continue to run forever. Another common mistake is that, you do add to the counter, but then accidently overwrite it again at the start of the next loop, so you never gain any ground.

Depending on what your loops is doing, this can cause your script to continue to output the same information over and over again (continuing to make the page longer and longer and longer) or it can keep processing the same information over and over without outputting anything giving it the appearance of a page that is trying to load but is lagging.

One way to help you spot this is to echo () the current counter number (or other useful information) at the beginning of each cycle. This way you might get a better idea of where the loop is tripping up.

If you're not using loops, you may want to double check that any HTML or JAVA you are using on your page isn't causing the problem, and that any included pages are without error.

If your page is blank, you may also find help in this FAQ.

More PHP / MySQL Q&A
Explore PHP / MySQL
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. PHP / MySQL
  4. Troubleshooting
  5. PHP Keeps Loading - PHP Dosen't Stop Loading - PHP Continual Loading

©2009 About.com, a part of The New York Times Company.

All rights reserved.