Best practice for if (!$stmt->execute())

From: Date: Mon, 25 Oct 2010 04:06:24 +0000
Subject: Best practice for if (!$stmt->execute())
Groups: php.general 
Request: Send a blank email to php-general+get-309048@lists.php.net to get a copy of this message
Hi. I have been doing like this: if (!$stmt->execute()) { return false; } else { ... some code return true; OR return $foo; // Some int, string, whatever. } I am thinking about changing the "return false" with a: if (!$stmt->execute()) { die(DB_ERROR); This way making sure that every single db execute gets a valid check and at the same time return some kind of valuable db error to the user and end the script. How do you deal with db execution checks? Thanks in advance! Best regards. Rico.

« previous php.general (#309048) next »