-
How to do correct code for errors?
How to manage errors?I have this code:
[PHP]
@mysql_query ($query,$link);
if(mysql_error($link)) {
$errorID = '1';
$errorTxt = mysql_errno($link) . ": " . mysql_error($link);
error_logger($errorID,$errorTxt);
function error_logger($date,$time, $errorID,$errortext)
{
/* Connect to MySQL-Server */
$db=DB_DATABASE;
$link=mysql_connect (DB_SERVER,DB_SERVER_USERNAME,DB_SERVER_PASSWORD);
if (!$link)
{
die ("Couldn't connect to MySQL:". mysql_error());
}
/* Open $db */
mysql_select_db ("$db")
or die ("Couldn't open $db: ". mysql_error());
$time= date("H:i:s", mktime(date("h")-6, date("i"), date("s"), date("n"), date("j"), date("Y")));
$date= date("Y-m-d", mktime(date("h"), date("i"), date("s"), date("n"), date("j"), date("Y")));
@mysql_query = "insert into errors_logs
values ('$date','$time', '$errorID','$errortext')";
}
I would like to do correct code that user will not notice any error and all errors will be stored in MYsql table. Need help
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks