Jump to content

clean alternative to mysql_query('...')or trigger_error(mysql_error(),256);


daydreamer

Recommended Posts

I am currently using my own error handler so i can log all mysql errors into a mysql table:

mysql_query('select data from table')or trigger_error(mysql_error(),256);

 

If there's an error i need to know the line number where the mysql_query function was called.

 

Is it possible to instead use this code:

mysql_query('select data from table');

 

but somehow transparently log a mysql error and the line number if there is an error in the query?

 

thanks

 

 

 

Link to comment
Share on other sites

That page is helpful, i am aware of __LINE__, but the problem is I would need to know the line number where the function was called without passing __LINE__ as a argument.

 

e.g.

function mysql_query(){//override mysql_query
        mysql_query()or error_function(error_code,error_string,line_number);
}


mysql_query(); //<<< need to log this line number

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.