Page 1 of 1

How to display line number where error occurs

Posted: Mon Mar 02, 2009 1:17 am
by eshban
Hello,

I am trying to writing a code i.e if query dies then admin will got an email with the following information. I have shown the following information in an error email

Complete URL :
Date and Time:
Logged In User name:
User Type:
Query that dies:

Everything is going well.

Now i want to display the LINE NUMBER of the code where error occurs.

I am unable to do this. Kindly help me in this regard. It takes my lot of time

Regards,
Eshban

Re: How to display line number where error occurs

Posted: Mon Mar 02, 2009 2:40 am
by requinix
The magic constant __LINE__ is the line number it is on.

Code: Select all

<?php
 
// blah
// blah
// blah
mysql_query($query) or die(query_error($query, __LINE__));
query_error takes a query and a line number and sends the email.