Page 1 of 1

Web-Host as LocalHost?

PostPosted: 06. November 2003 19:29
by George-Edward
Is there a way I could 'include' my webhost as a localhost?

All my scripts are using (Host) fp.enter.net, when I try to pull up the page I get:

Warning: mysql_connect(): Unknown MySQL Server Host 'fp.enter.net' (11004)

I'd like to have 'fp.enter.net' = 'localhost', so I could pull up mySQL without this type of error.

I don't want to go into each script and change it for local and then change it back before I upload it to the webserver.

I got the dbTable working in PHPmyADMIN, but can't get it access thru my scripts.

Please reply with your ideas to make this work, WITHOUT re-coding all my scripts TWICE.

Thanx

ok

PostPosted: 07. November 2003 16:45
by MAGnUm
Yep

I got it

PostPosted: 08. November 2003 01:56
by George-Edward
Code: Select all
IF ($HTTP_HOST == "127.0.0.1")
{
$db_host = "localhost";
}
else
{
$db_host = "fp.enter.net";
}


I also put db_user and db_pw in there, then COPY / PASTE thru-out the pages.

It looks like it will keep me happy for a long time.

Thanks

why not like this...?

PostPosted: 12. November 2003 06:59
by chanio
:lol: $db_host = $HTTP_HOST;