<?php

function db_connect() {
   $result = mysql_connect('localhost', 'username', 'password');
   if (!$result) {
     throw new Exception('Could not connect to database server');
   } else {
     return $result;
   }
}

?>

