Re: Best way to check if a query succeeded

From: Date: Thu, 29 Mar 2001 16:25:12 +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-7996@lists.php.net to get a copy of this message
The best way ... regarding to what expectations? The query doesn't succeed because... - the host running the mysqldemon died? - the mysqldemon died? - your ISP died? - the hard disk holding the database died? - the disk holding the database run out of space? - the disk holding the cache run out of space? - the result set was to big? - there was some sort of time out - (imaging all sort of time outs?) - there was a problem (there will always be problems...) - there was a bug (imaging all sort of bugs?) - there was a php syntax error? - there was a mysql syntax error? - there was a mixed problem? You ever heard of 'defensive coding'? Think: All software is always befuddled with error... Tell yourself and your audience something about the problems your application is involved with. Be friendly to your visitors... don't : die ("Query failed!"); got it? Hans-Werner Guth Jon Haworth wrote: > > What about: > > $sql = "SELECT something FROM table"; > $result = mysql_query($sql) or die ("Query failed!"); > do_something(); //the query has succeeded if we get to this line > > ...snipp... -- Hans-Werner Guth S http://www.qits.de QITS GmbH T mailto:hwguth@qits.de Formerstr 53 I fon +49-2102-852-145 40878 Ratingen Q fax +49-2102-852-202

« previous php.db (#7996) next »