RE: [PHP] mysql not reporting errors

From: Date: Sat, 10 Feb 2001 08:45:29 +0000
Subject: RE: [PHP] mysql not reporting errors
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-39059@lists.php.net to get a copy of this message
Hi Anna, Have you ever heard of PHP Library (PHPLIB) ? It is quite simple to install and will give you possibility of easily switching between databases as well as choosing when and how to receive the database errors. It also has a whole bunch of other features - a very good base for development. If you wonder where to get PHP Library here's the link www.phplib.org Sincerely, Maxim Maletsky Founder, Chief Developer PHPBeginner.com (Where PHP Begins) maxim@phpbeginner.com www.phpbeginner.com -----Original Message----- From: Anna [mailto:programmer@samaranet.com] Sent: Saturday, February 10, 2001 7:12 AM To: php-general@lists.php.net Subject: Re: [PHP] mysql not reporting errors ----- Original Message ----- From: "Christian Dechery" > WHy PHP is not showing SQL syntax (or any) errors? > > I'm using Win98Me with Apache 1.3.12 and PHP 4.x. > > it works... if I run a correct query it runs normally, but if I go like: > > $query="selct nonexistingfield from nonexistingtable with all crazy syntax"; > mysql_query($query); > > it doesn't tell me there's an error... in fact it doesn't show anything... > why is that? Because it's a pain to have error messages popping up all the time? Here is what I do with every query I every write: $query="yada yada"; $result=mysql_query($query, $connection); if($result=="" || $result=="0") { //if it is a page for my use, I print the error // if it is a page for the general public, I email the //error to myself, and print "There was a problem //completing your request", or something like that. print "Error : ".mysql_error($connection)."<br>\n"; } else { while($row=mysql_fetch_row($result)) { //do whatever you want to do with the data. } } I greatly prefer this to display "0 is not a mysql result index" for everyone to see, if/when something goes wrong. Anna -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#39059) next »