The easiest way to do this would be to write a wrapper function to
mysql_query() that does the writing to the log file and also executes the
query and returns the result set.

function my_mysql_query($query)
    //assuming file would already be open...
    global $fp;

    $return = mysql_query($query);
    $error = mysql_error();

    fwrite($fp,"info you want to save");

    return $return;

Can be improved upon many many ways I'm sure...just an idea.

---John Holmes...

----- Original Message -----
To: "php-general" <[EMAIL PROTECTED]>
Sent: Monday, July 22, 2002 2:30 PM
Subject: [PHP] MySQL - PHP combined log

> Hi, tried this on mysql list, no luck:
> I want to be able to view a single log that contains the following:
> IP of user : page_name (PHP only): time/date: MySQL query ( 'select *
> from xxx' etc.) : error msg from mysql/php if any
> So it's almost a hybrid between apache and mysql with some extra's
> I'm sure you all should see the benifit of this in troubleshooting and
> specially keeping track of who does what when it comes to PHP coding on
> ones server, specially with crappy code that kills the server.
> Is something like this possible, already there?
> PS, Running RedHat 7.0 with PHP4 and mysql 3.23.x
> Ta
> --
> PHP General Mailing List (
> To unsubscribe, visit:

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to