[SOLVED]Class / headers problem

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
rubberjohn
Forum Contributor
Posts: 193
Joined: Fri Feb 25, 2005 4:03 am

[SOLVED]Class / headers problem

Post by rubberjohn »

Hi,
I'm trying to get my head around using classes. I'm playing around with the example on

viewtopic.php?t=8873.

Everything works fine except when I try and use a header() redirect - I get the error message saying that output has already started (as happens if something is echoed before the header()). It says that the output started in the class file - even if I comment every in the class out, it still does it.

Can anyone tell me why this is happening?

Does it have anything to do with instantiating the class, does that start an output?

thanks

rj
Last edited by rubberjohn on Thu Mar 23, 2006 3:40 pm, edited 1 time in total.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: Class / headers problem

Post by Chris Corbyn »

rubberjohn wrote:Hi,
I'm trying to get my head around using classes. I'm playing around with the example on

viewtopic.php?t=8873.

Everything works fine except when I try and use a header() redirect - I get the error message saying that output has already started (as happens if something is echoed before the header()). It says that the output started in the class file - even if I comment every in the class out, it still does it.

Can anyone tell me why this is happening?

Does it have anything to do with instantiating the class, does that start an output?

thanks

rj
Have you got a space or a blank line before your opening PHP tag perhaps? Error messages sometimes cause output too.
rubberjohn
Forum Contributor
Posts: 193
Joined: Fri Feb 25, 2005 4:03 am

Post by rubberjohn »

no, the thing is i'm using it on an old script that worked fine and now that i've started using classes on it, it won't work.

rj
User avatar
neophyte
DevNet Resident
Posts: 1537
Joined: Tue Jan 20, 2004 4:58 pm
Location: Minnesota

Post by neophyte »

check after the closing "?>" any spaces after it? Post yon code over hither.
rubberjohn
Forum Contributor
Posts: 193
Joined: Fri Feb 25, 2005 4:03 am

Post by rubberjohn »

yep that was it cheers :oops:
Post Reply