29-03-2010, 07:33 AM
The complete code for this tutorial can be found at the bottom in the "tips" section.Create a junk MySQL query in your PHP file. I just put in random characters for the "user name" and "password" fields in the mysql_connect() statement. You should get an error similar to that shown in the image.The error shown may be good when you're developing, but you wouldn't want everyone to see what your user name and host name are. You could get hacked, and that's never a good thing. We also don't want to just silence all errors (@), since if there is an error we want to know what it is. So, we'll use a log file (in this case, log.txt). We're going to create a function called writeErrors().