I'm trying to write a log record into a mySQL table every time a user requests a particular report. The report itself is generated using cURL (though I don't know why that would have anything to do with the problem) and then I call the logging function which inserts a record into the table.
Here's the problem: If the user requests the report using IE, everything works as expected. If the user requests the report using Firefox 1.5, two records are written into the database. Even more strange -- the second record has blank values for fields which are based on $POST variables, even though the first record has values for those fields. It's as though the $POST variables have somehow gotten deleted. And when I put debugging code in (using an echo statement) to see if the logging function is somehow being run twice (which it seems it must be for two records to be written), the echo statement is only executed once.
Any ideas?
Here's my logging function:
function logdb($action, $message) {
$logSQL = sprintf("INSERT INTO log (username, nl_id, action, message, ip, date) VALUES (%s, %s, %s, %s, %s, NOW())",
GetSQLValueString($_SESSION['MM_Username'], "text"),
GetSQLValueString($_SESSION['nl_id'], "text"),
GetSQLValueString($action, "text"),
GetSQLValueString($message , "text"),
GetSQLValueString($_SERVER['REMOTE_ADDR'], "text"));
global $database_phpconnect, $phpconnect;
mysql_select_db($database_phpconnect, $phpconnect);
$Result_log = mysql_query($logSQL, $phpconnect);
}