Re: Will not report errors what can I do

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

 



At 3:07 PM -0800 12/4/08, Jim Lucas wrote:
Terion Miller wrote:

 >
     $query = "SELECT ViewAllWorkOrders FROM admin WHERE AdminID='$AdminID'";
     $result = mysql_query ($query);

Not the best solution, but add this to the above line...

$result = mysql_query ($query) or die(mysql_error());

Agreed.

I go even a bit further, like so:

$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.

Cheers,

tedd


--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
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