Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

database connection

Status
Not open for further replies.

hex6007

MIS
Sep 2, 2008
53
PH
How to code server and database connection, if the connection to the server fails, it will automatically redirect and establish connection to my local computer. pls help.

thanks in advance

 
Code:
$conn = mysql_connect($remotehost, $remoteuser, $remotepassword);
if (!$conn){
 $conn = mysql_connect('localhost', $localuser, $localpassword) or die ('cannot connect');
}
mysql_select_db($databaseName, $conn);
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top