RE: [PHP] header and writing problem

From: Date: Wed, 26 Feb 2003 09:25:47 +0000
Subject: RE: [PHP] header and writing problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-137208@lists.php.net to get a copy of this message
Ernest, That worked a treat, many thanks. George > -----Original Message----- > From: Ernest E Vogelsinger [mailto:ernest@vogelsinger.at] > Sent: 26 February 2003 9:16 am > To: George Pitcher > Cc: php-general@lists.php.net > Subject: Re: [PHP] header and writing problem > > > At 10:02 26.02.2003, George Pitcher said: > --------------------[snip]-------------------- > >Hi all, > > > >Back on the list after a long break. > > > >I want to be able to write all my sql queries (well at least the > ones that > >change or create records) to a log file. > > > >However some of the pages that contain these queries are just used to > >redirect the user depending on the result. > > > >Writing to a file id not permitted before creating the header for the > >redirect. > --------------------[snip]-------------------- > > This works for me: > > <?php > $hf = fopen('cache/sample.txt', 'w'); > fwrite($hf, 'Test'); > fclose($hf); > header('Location: http://www.php.net/'); > ?> > > (./cache is an apache-writable directory on my test server) > > This seamlessly writes the file, then redirects to the requested site... > what errors do you get? > > > -- > >O Ernest E. Vogelsinger > (\) ICQ #13394035 > ^ http://www.vogelsinger.at/ > > >

« previous php.general (#137208) next »