Re: [PHP] Re: custom error handling

2003-01-08 Thread electroteque
actually its getting there

$backtrace = debug_backtrace();

  foreach ($backtrace as $val) {
   if (eregi($val['function'],'query')){
   echo $val['file'].br;
   echo $vale['line'].br;
   }
  }

Michael Sims [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
On Wed, 8 Jan 2003 08:28:58 +1100, you wrote:

 hi there i am trying to build a ustom error handler for the pear db
aswell
 as catch fatal and parse errors , unfortunatly the pear  db error message
 wont give me back the file and the line where the error is, how can i
 determine the line and file where the error is caused ufortunatly the
 callback funtion with the params $errfile and $errline return the file
that
 contains the trigger not the script itself !

If you're running PHP 4.3.0 use debug_backtrace() inside your custom
error handler to trace the error.  If you're not running PHP 4.3.0
consider upgrading, because debug_backtrace() is a lifesaver.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: custom error handling

2003-01-07 Thread electroteque
here is an example of the error sorry forgot to add it

DB Error: syntax error
SELECT gallery FROM galleries WHERE galleryID= [nativecode=1064 ** You have
an error in your SQL syntax. Check the manual that corresponds to your MySQL
server version for the right syntax to use near '' at line 1]

like line 1 could be anywhere and the query i buggered on purpose is 100
lines down

Electroteque [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 hi there i am trying to build a ustom error handler for the pear db aswell
 as catch fatal and parse errors , unfortunatly the pear  db error message
 wont give me back the file and the line where the error is, how can i
 determine the line and file where the error is caused ufortunatly the
 callback funtion with the params $errfile and $errline return the file
that
 contains the trigger not the script itself !





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Re: custom error handling

2003-01-07 Thread Michael Sims
On Wed, 8 Jan 2003 08:28:58 +1100, you wrote:

 hi there i am trying to build a ustom error handler for the pear db aswell
 as catch fatal and parse errors , unfortunatly the pear  db error message
 wont give me back the file and the line where the error is, how can i
 determine the line and file where the error is caused ufortunatly the
 callback funtion with the params $errfile and $errline return the file
that
 contains the trigger not the script itself !

If you're running PHP 4.3.0 use debug_backtrace() inside your custom
error handler to trace the error.  If you're not running PHP 4.3.0
consider upgrading, because debug_backtrace() is a lifesaver.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php