MyBB Community Forums
[PHP] MySQL errors - Printable Version

+- MyBB Community Forums (
+-- Forum: Community (
+--- Forum: General Discussion (
+---- Forum: Web Development and Administration (
+---- Thread: [PHP] MySQL errors (/thread-111886.html)

[PHP] MySQL errors - ThatHeart - 2012-01-18

When MySQL has an error, it displays an error page. (look below)

[Image: 2v3t06d.png]

But how is this done? Isn't there code executed before the query that causes the error? How does it hide it?

What I'm trying to do in PHP is show an error page (hide other executed/echo'd things) on errors, like MyBB has done.

Help please Big Grin

RE: [PHP] MySQL errors - Euan T - 2012-01-18

Here's the error function from the database within MyBB:

	function error($string="")
				global $error_handler;
					require_once MYBB_ROOT."inc/class_error.php";
					$error_handler = new errorHandler();
				$error = array(
					"error_no" => $this->error_number(),
					"error" => $this->error_string(),
					"query" => $string
				$error_handler->error(MYBB_SQL, $error);
				trigger_error("<strong>[SQL] [".$this->error_number()."] ".$this->error_string()."</strong><br />{$string}", E_USER_ERROR);
			return false;

That should help you out a little bit Smile

RE: [PHP] MySQL errors - Tom K. - 2012-01-18

Just take a look at /inc/class_error.php Smile I've been busy adding extra error pages for a project I'm working on Smile