Forum Moderators: coopster
I have a very stupid hypothetical php script that I want to do. I want to have the index.php to query the 2 servers to see if the name and the state of the visitor matches my enemy list which are mysql 2 identical databases in 2 separate servers.
I have 2 textboxes in the form which user input Name and State.
Say I have 3 servers. Server1 is the main server.
Server2 and server3 are database servers, server3 is backup server in case server2 goes down.
Server1:
index.php
Server2:
the database
Server3
the database
Database contents
------------------
¦ Name ¦ State ¦
------------------
¦ Chan ¦ Chicago ¦
------------------
¦ Mike ¦ Colorado ¦
------------------
¦ Alex ¦ Michigan ¦
------------------
What should I have in the index.php to query server2 first then if it is is down query server3,
If name and state matches,index.php spits out "$name from $state, you are an idiot!Can't believe you are still alive! Get out of my website you loser!" , If not, it will echo "Congratulations, you are not in the idiots list!"
What should I have in the index.php to query server2 first then if it is is down query server3
mysql_connect - Returns a MySQL link identifier on success, or FALSE on failure.
$dbh1=mysql_connect($server1, $user, $password);
if (!$dbh1) $dbh2=mysql_connect($server2, $user, $password);
if (!$dbh2) echo "both servers are down, too bad.";