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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux