RE: [PHP] RE: [PHP-DB] Best way to check if a query succeeded

From: Date: Thu, 29 Mar 2001 14:39:54 +0000
Subject: RE: [PHP] RE: [PHP-DB] Best way to check if a query succeeded
Groups: php.db php.general 
Request: Send a blank email to php-db+get-7983@lists.php.net to get a copy of this message
> Doesn't the command return 1 or 0 in success or failure? Not 1 or 0. It returns 0 or some other value. Almost the same, but not quite. > You may not have a result > Probably wrong but something like > if (mysql_query($query)) { > } else { > } > or you could die out mysql_query($query) or die ........ You could do that. But once you run the query, that's it. You'll have nothing to use with any of the other mysql functions because you need to pass to them the value that mysql() returns. So while the above might tell you whether or not the query succeeded, that's all you would get out of it. Chris

« previous php.db (#7983) next »