that worked perfectly - thanks. can you tell me why the \r is necessary?
Main Topics
Browse All TopicsHello all!
This should be an easy one. I am writing some exception handling to my database classes, and I want to log the exceptions thrown into a log file. This part is done. However, when I use \n to write a new line to the file, when I open the log file in Notepad, all I see is a little box, instead of the line ending.
Any thoughts?
Thanks.
Code is below....I have left the $type variable blank in the query function call in test_mysql.php in order to have it error intentionally (to check the logging capabilities)
***** START CODE *****
mysql.php snippet
--------------------------
function query($SQL,$type){
if($type == "" || $type == NULL)
{
throw new Exception("No query type has been stated. Cannot continue.");
}
test_mysql.php snippet
--------------------------
require_once("mysql.php");
$db = new mysql();
try
{
$response = $db->query("SELECT * FROM uploads","");
echo $response;
}
catch(Exception $e)
{
$error = "ERROR: Exception occurred. ". $e->getMessage() ." (Exception Code ". $e->getCode() .") in ". $e->getFile() ." on line ". $e->getLine() .".";
echo $error;
error_log($error."\n", 3, "dbErrorLog.log");
exit();
}
****** END CODE ******
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
The're called escaped characters, read more about it here:
http://nl2.php.net/manual/
Business Accounts
Answer for Membership
by: TeRReFPosted on 2007-01-05 at 09:49:13ID: 18253201
use \r\n instead of just \n