SQL db check

Ive debated this for awhile after I ran into a crap load of issues with my hosting's SQL server. I was curious to know if there is a way to write a db check into my .htaccess file that would verify if a connection is present and if not transfer to another domain?? I know it can be done manually in Cpanel (domain fowarding) but I would like a way for this to be into play instead of SQL errors. Ideas??

Which SQL?

But probably no. That's the sort of thing you'd do in PHP. If you can check before PHP actually outputs anything, you can dump a header() to redirect then quit if the SQL doesn't work.

I actually found something like that written in PHP but i didnt like how it required you to enter the db name, password, and user. I thought that would be a major security risk.

It was here

Yes, that one would be.

Hardcode your own simple one with fixed connection details and it won't be vulnerable to injection.