Database error trapping.

New mysqli always returns an object. Test for connection error.
Use die to trap errors, will use proper error log soon.