flolam Posted March 4, 2011 Share Posted March 4, 2011 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.