Once all the sql queries are carried out in a page, what PHP should I use to redirect them somewhere?
Like in phpBB, redirect(append_sid("foo.com", true)); is used sometimes
Printable View
Once all the sql queries are carried out in a page, what PHP should I use to redirect them somewhere?
Like in phpBB, redirect(append_sid("foo.com", true)); is used sometimes
Hi,
Try using header('Location: http://foo.com');.
yours, Erik.
But doesn't that only work if it's the first line of code?
No, it does not have to be the first line of code in your PHP script, but it does have to be the fist line of code that is output by your script. This avoids that 'headers already sent' message.
You should also follow header() with exit().
I have some message_dies (die)
Will that affect it?
only if the code fails futher up the script.
Only if the die() is executed. You can also cache the output and then you don't have to worry about where you put header()