Page 1 of 1

db on a different server

Posted: Wed Jul 06, 2005 11:29 am
by sanch3x
Hey guys,

I got a forum coded for me with php. Anyways, the server where my website is located is blocked at my work because it was identified as a "game" site (I think it has to do with the DNS or what not)...

So the thing is, I'd like to make a "mirror site" that would be on an acceptable server but I would like to use the database on the blocked one. How can I query a DB that is on a different server?

The site is already running so is it just a different in connections, or sql queries or what?

Thanks for any help :)

Seb

Posted: Wed Jul 06, 2005 11:47 am
by timvw
Assuming you are using mysql: http://www.php.net/mysql_connect


For example, your database is at forbidden.example.com

Code: Select all

<?php
mysql_connect('forbidden.example.com', 'username', 'password') or die(mysql_error());
?>
database is at forbidden.example.com

Code: Select all

<?php
mysql_connect('forbidden.example.com', 'username', 'password') or die(mysql_error());
?>

Code: Select all

<?php
mysql_connect('forbidden.example.com', 'username', 'password') or die(mysql_error());
?>
ysql_connect[/url]


For example, your database is at forbidden.example.com

Code: Select all

<?php
mysql_connect('forbidden.example.com', 'username', 'password') or die(mysql_error());
?>
sing mysql: http://www.php.net/mysql_connect


For example, your database is at forbidden.example.com

Code: Select all

<?php
mysql_connect('forbidden.example.com', 'username', 'password') or die(mysql_error());
?>
sing mysql: http://www.php.net/mysql_connect


For example, your database is at forbidden.example.com

Code: Select all

<?php
mysql_connect('forbidden.example.com', 'username', 'password') or die(mysql_error());
?>
at forbidden.example.com

Code: Select all

<?php
mysql_connect('forbidden.example.com', 'username', 'password') or die(mysql_error());
?>

Code: Select all

<?php
mysql_connect('forbidden.example.com', 'username', 'password') or die(mysql_error());
?>
ttp://www.php.net/mysql_connect[/url]


For example, your database is at forbidden.example.com

Code: Select all

<?php
mysql_connect('forbidden.example.com', 'username', 'password') or die(mysql_error());
?>
onnect[/url]


For example, your database is at forbidden.example.com

Code: Select all

<?php
mysql_connect('forbidden.example.com', 'username', 'password') or die(mysql_error());
?>
<?php
mysql_connect('forbidden.example.com', 'username', 'password') or die(mysql_error());
?>

Posted: Wed Jul 06, 2005 11:52 am
by sanch3x
Wow, as simple as that...

Thanks a lot! :D