PDA

View Full Version : Which database am I using?


MortimerCat
08-25-2003, 11:50 PM
I am running PHPtriad (ie Apache & mySQL) on my own personal development PC, where I write my PHP script. Once my PHP is running, I transfer it to my Web Host.

What is the best way of PHP knowing which mySQL host the script is using.

My main reason is that I have accidently setup different names on the two machines. :dnkn:

I want to do

if (DevelopmentMachine)
{
mysql_select_db("dev37",$db);
}
else
{
mysql_select_db("live37",$db);
}


Thanks

Premium Support
08-26-2003, 11:31 AM
Originally posted by MortimerCat

What is the best way of PHP knowing which mySQL host the script is using.


Dear Customer,

It would depend where you run your script.

If you run your script at VH server then you would need to refer to VH db server as ‘localhost’. Your own server would, apparently, have some other name.

There are many ways to distinguish between the servers you run your script on, e.g. by IP address. You can find out IP address of your VH account by typing “ping YOURDOMAINNAME” in command prompt.

Best Regards,
Valuehost Limited --- The Host with the Most
Premium Support Team