note 104284 added to function.mysql-connect

From: Date: Sun, 05 Jun 2011 19:15:45 +0000
Subject: note 104284 added to function.mysql-connect
Groups: php.notes 
Request: Send a blank email to php-notes+get-180286@lists.php.net to get a copy of this message
Portable connections: If you migrate your source code from one to different servers and you would like to avoid re-configuration on a new serve, user the $_SERVER['SERVER_NAME'] flag as: <?php switch($_SERVER['SERVER_NAME']) { case 'server1.domain.com': mysqlconnect('host1', 'user1', 'password1'); mysql_select_db('db1'); break; case 'server2.domain.com': mysqlconnect('host2', 'user2', 'password2'); mysql_select_db('db2'); break; } ?> This makes a conditional connection to mysql database. It automatically chooses the correct server according to the server name from where your script runs. Hopefully, you like this portable configuration. ---- Server IP: 69.147.83.197 Probable Submitter: 110.34.0.242 (proxied: 116.66.193.69) ---- Manual Page -- http://www.php.net/manual/en/function.mysql-connect.php Edit -- https://master.php.net/note/edit/104284 Del: integrated -- https://master.php.net/note/delete/104284/integrated Del: useless -- https://master.php.net/note/delete/104284/useless Del: bad code -- https://master.php.net/note/delete/104284/bad+code Del: spam -- https://master.php.net/note/delete/104284/spam Del: non-english -- https://master.php.net/note/delete/104284/non-english Del: in docs -- https://master.php.net/note/delete/104284/in+docs Del: other reasons-- https://master.php.net/note/delete/104284 Reject -- https://master.php.net/note/reject/104284 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#180286) next »