Better error message when things go wrong

Removed sql statement from index.php. Now only presentation logic is
required.
Added better messaging to display to user if db connection not setup or
broken.