Greetings,
I have 2 working websites, one based on php and the other one purely based on html. The Html-based will serve as a backup just in case the mysql database is down. How would I named my startup pages - right now the html-based is named index.html and the other one is index.php. What would be the best way to make the php-based index page the default and the html-based index serve as a backup.
Thank you.
Your best bet is to use the php page (index.php) and then to do a check on the databases.
So do a connection test, if the connection test fails, you then have to re-direct the user to index.html.
This will then be loaded as a static page.
Would you be so kind just to post a sample code to make it happen?
Also if I make an index.php and a index.html the browser gives priority to index.html.
You can always name it _index.html (note the underscore).
Sample code:
$connect = mysql_connect("localhost", "root", ""); $selectDB = mysql_select_db("creditcards"); // Both of the above functions return FALSE on failure if (!$connect || !$selectDB) { header("Location: _index.html"); } else { echo "Connected to credit cards database with username root and blank password. Sweet."; }
lol, nice password :p
Sweet thanks.