Error log mysql record class. method
// Create an error log
Function error (){
$ Fp = @ fopen ("error. dat", "a + ");
$ Time = date ("Y-m-d H: I: s ");
$ Msg = "{VisitedTime: $ time} {VisiterIP: $ _ SERVER [REMOTE_ADDR]} {Errormsg:". mysql_error ()."}
{File:-> $ _ SERVER [PHP_SELF]} {User: $ _ SESSION [user]} ";
@ Fputs ($ fp, $ msg );
@ Fclose ($ fp );
}
When you use mysql as a site, you must have an error that you don't know. how can you record it? Can I use mail to send emails to your mailbox? Are you sure you can receive the email? In linux, you can send root sendmail for maintenance purposes. But is there too many root emails? Create another user?
This directly creates an error log in your Directory
The above is the error record method in a class I used
This is called on the page that uses the mysql connection.
If (mysql_error ()){
$ Classname-> error ();
}
______________________________________________
Once an error occurs on your page, the information will not be leaked as long as you shield the hidden information.
Error. dat content is (eg .)
{VisitedTime: 14:43:56} {VisiterIP: 127.0.0.1} {Errormsg: Duplicate entry '0' for key 1} {File:->/path/errorfilename. php} {User: sports98}
I think this record will certainly be good for you to analyze your page.
If you are using include, do not add _ LINE __
If you are using require, we recommend that you add _ LINE _ to help you quickly locate the error so that you can solve the problem easily.