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)
[EMAIL PROTECTED]
www.phpbeginner.com
-----Original Message-----
From: Anna [mailto:[EMAIL PROTECTED]]
Sent: Saturday, February 10, 2001 7:12 AM
To: [EMAIL PROTECTED]
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]