Forum Moderators: coopster
function message($location,$line,$status,$message){
$line = str_pad($line,3,'0',STR_PAD_LEFT);
$message = '['.$line.'-'.$status.']'.' - '.$message.'.';
$dberror = '['.__LINE__.'-'.'E'.']'.' - '.'Error-log table insert failed: '.mysql_error().'.';
$file = fopen('../log/error-log.txt','at'); // write errors to this flat file before database is opened or if database or tables can not be accessed.
switch ($location) {
case 'db': // write to database table error-log.
$query = mysql_query('INSERT INTO `error-log` (Message) VALUES ("'.CheckField($message).'")'); // CheckField escapes any special characters before being inserted into the database table.
if(!$query){
if($file)fwrite($file,$dberror.'\n');
if($file)fwrite($file,$message.'\n');
}
break;
case 'fl': // write to error-log flat file.
if($file)fwrite($file,$message.'\n');
break;
default:
break;
}
fclose($file);
} \n is only a newline (seems to work fine on windows, but wont do much good on linux)
You might want to try "\r\n" (note the double quotes)
I did not know that double quotes enabled variable parsing.