[thelist] php/mysql update, then redirect

Andrew Forsberg andrew at thepander.co.nz
Fri May 3 17:37:01 CDT 2002

On Sat, 2002-05-04 at 03:09, Matthias Ritzkowski wrote:


> My problem is on "update.php".
> I want to use an include for the connection string, but I can't do that
> because of the header function I use after the query was fired.

Say what? Why does it matter whether a header function has been called
or not? Why won't something like

require_once '../incs/DB_defines.php';

solve this at any stage before or after the header function is called?

Do you mean a header function as in HTTP header() not a template header?
The only reason that could become a problem is if there's a blank line
or some other output created by the DB_defines.php file (or whatever you
call it). If the first line in the defines file is <?php and the last is
?> then you should still be cool to write to the HTTP header. At any
rate the defines file will just have a list of

define ('HERE_IS_MY_VAR', 'foo at bar:whatever....');


$dsn = "whatever at foo:.....";

It doesn't need to output anything that would interfere with the use of
header() or session_start(), etc...

> My solution so far was to write out the connection string, which defeats the
> purpose of using it in an include file in the first place.

It sure would. :-)


More information about the thelist mailing list