Re: Best way to check if a query succeeded

From: Date: Thu, 29 Mar 2001 17:25:14 +0000
Subject: Re: Best way to check if a query succeeded
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-8002@lists.php.net to get a copy of this message
I see you there's been lots of responses already, but there's an important related bit of news folks might want to know. Everyone who uses the mysql_affected_rows() should know that a bug was fixed in 3.23.36 that evidentally reports affected rows incorrectly if MySQL was compiled without support for transactions. Go to http://www.mysql.com/documentation/mysql/bychapter/manual_News.html and scroll down to section F.2.2. It's the 8th item in the list. So shy away depending on mysql_affected_rows() for anything unless you're absolutely sure you're running at least 3.23.36 or have transaction support compiled in. Doug At 12:00 PM 3/29/01 +0100, Jordan Elver wrote: >Hi, >i was just wondering what you guys do to check if a wquery suceeded or not? >I know about mysql_num_rows() and mysql_affected_rows(), just wondered what >you guys do? > >I normally do something like: > >$sql = "SELECT something FROM table"; >$result = mysql_query($sql); >if(@mysql_num_rows($result) > 0) { > echo'Query Suceeded'; >} else { > echo'Query failed'; >} > >Cheers, > >Jord

« previous php.db (#8002) next »