Re: Will not report errors what can I do

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2008-12-05 at 10:40 -0500, tedd wrote:
> At 3:19 PM +0000 12/5/08, ceo@xxxxxxxxx wrote:
> >  > $result = mysql_query($query) or die(report($query,__LINE__ ,__FILE__));
> >>
> >>  //====================  to show dB errors  ======================
> >>
> >>  function report($query, $line, $file)
> >>      {
> >>     echo($query . '<br>' .$line . '<br/>' . $file . '<br/>' .
> >>  mysql_error());
> >>     }
> >>
> >>  This does two things: 1) It tells where the error took place
> >>  (line/file); 2) and it provides a single place in my entire project to
> >>  turn-off dB error reporting -- all I have to do is comment out a single
> >>  line.
> >
> >I did this, briefly, but got tired of typing __LINE__, __FILE__ so much.
> 
> 
> That's what I call common code -- I type it once and after that it's 
> all cut/paste.
> 
> I have entire libraries of routines that I've used before -- I just 
> cut/paste them into the new stuff as needed. Even many of the 
> variable names remain the same so it becomes more a job of assembly 
> more than typing.

I have to say... for what he's trying to achieve, I cheat and extract
the file and line number via debug_backtrace(). Indeed, it is annoying
to type the same thing over and over :)

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux