Re: [PHP] header and writing problem

2003-02-26 Thread Ernest E Vogelsinger
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/



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] header and writing problem

2003-02-26 Thread Niklas Lampén
I think this can be done with mySQL (if you're using it) log-files.


Niklas

-Original Message-
From: George Pitcher [mailto:[EMAIL PROTECTED] 
Sent: 26. helmikuuta 2003 11:02
To: [EMAIL PROTECTED]
Subject: [PHP] header and writing problem


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.

can anyone suggest a workaround.

Cheers

George


===

George Pitcher
HERON Technical Manager
Ingenta plc
23-38 Hythe Bridge Street, Oxford, OX1 2ET
T  +44 (0)1865 799137 direct
T  +44 (0)1865 799000 switchboard
F  +44 (0)1865 799134
E  [EMAIL PROTECTED]

www.ingenta.com
Ingenta: Empowering the exchange of academic and professional content
online.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail. For
more information, connect to http://www.F-Secure.com/

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] header and writing problem

2003-02-26 Thread George Pitcher
Ernest,

That worked a treat, many thanks.

George

 -Original Message-
 From: Ernest E Vogelsinger [mailto:[EMAIL PROTECTED]
 Sent: 26 February 2003 9:16 am
 To: George Pitcher
 Cc: [EMAIL PROTECTED]
 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/
 
 
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] header and writing problem

2003-02-26 Thread Chris Shiflett
--- George Pitcher [EMAIL PROTECTED] wrote:
 Writing to a file id not permitted before creating the header for the
 redirect.
 
 can anyone suggest a workaround.

Have you tried it? I'm not sure who told you this, but they are wrong.

Chris

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php