Re: Will not report errors what can I do

From: Date: Fri, 05 Dec 2008 14:09:11 +0000
Subject: Re: Will not report errors what can I do
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-284162@lists.php.net to get a copy of this message
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

« previous php.general (#284162) next »