PHP doesn't seem to be generating HTML properly

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
impulse()
Forum Regular
Posts: 748
Joined: Wed Aug 09, 2006 8:36 am
Location: Staffordshire, UK
Contact:

PHP doesn't seem to be generating HTML properly

Post by impulse() »

Hello.

For some odd reason PHP has started to generate HTML incorrectly depending on where I access the file from.
Firstly, if I run the script from a shell using 'php <file>.php' the HTML is there and correct. But if I try and access it from a web browser it stops generating at a certain point, I can tell this by viewing the source of the web page.

Has anyone come across this before?

Stephen,
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

PHP only outputs what you tell it to, so somewhere you must be telling it to output bad HTML.
impulse()
Forum Regular
Posts: 748
Joined: Wed Aug 09, 2006 8:36 am
Location: Staffordshire, UK
Contact:

Post by impulse() »

This looks more like a server problem than code problem.

If I access the PHP files through a web page then everything after connecting to the MySQL isn't generated, whether it be database information or hard coded HTML. The server is there and runs correctly as I can run the php file from a shell and the HTML is generated fine.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

impulse() wrote:If I access the PHP files through a web page then everything after connecting to the MySQL isn't generated,
Put in more error handling and debug output.
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

You should do all your database connecting as well as any other non-templating logic LONG before you output any HTML, but that is irrelevant I guess...

Do what volka said.
Post Reply