RE: [PHP] How to connect Web Database from local machine
| From: | John W. Holmes | Date: | Sun, 06 Oct 2002 13:34:44 +0000 |
| Subject: | RE: [PHP] How to connect Web Database from local machine | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-118996@lists.php.net to get a copy of this message | ||
> I am having MySQL database on web. (eg., at www.lmcr.net). What is the
PHP
> script which I can connect the MySQL table from my Local machine. Can
> anybody help me.
Well, most hosting companies do not allow remote access to the MySQL
server, but if you're does, then you connect the same way as usual...
$link_id = mysql_connect("mysql.yourdomain.com","user","password");
You just pass the IP or name of your MySQL server in the mysql_connect
function. To also connect to your local database, just use
$link_id2 = mysql_connect("localhost","user","password");
And then you have a connection to each one open. Be sure to use the
appropriate $link_id in your queries.
---John Holmes...