Page 1 of 1

[SOLVED]Class / headers problem

Posted: Thu Mar 23, 2006 2:42 pm
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

Re: Class / headers problem

Posted: Thu Mar 23, 2006 3:03 pm
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.

Posted: Thu Mar 23, 2006 3:13 pm
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

Posted: Thu Mar 23, 2006 3:18 pm
by neophyte
check after the closing "?>" any spaces after it? Post yon code over hither.

Posted: Thu Mar 23, 2006 3:40 pm
by rubberjohn
yep that was it cheers :oops: