Jump to content

Error Handling: Is this the way to go?


flolam

Recommended Posts

Hi

I'm completely new to error handling in PHP and wanted to ask whether I'm doing it right and, if not, what the right way would look like

class DBConnection {
public function execute($sql) {
	$query = @pg_query($this->dbconn, $this->prepare($sql));
	try {
		if (!$query) {
			throw new DBException();
		}
	} catch (DBException $e) {
		echo "Query execution failed";
		exit;
	}
}
}

Link to comment
https://forums.phpfreaks.com/topic/229611-error-handling-is-this-the-way-to-go/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.