Home > Archive > PHP Language > July 2004 > PHP to mySQL connect...
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
PHP to mySQL connect...
|
|
| jsWalter 2004-07-24, 3:55 am |
| I have 2 machines, a server (Win NT server) and a workstation (Win XP Pro).
On the server I have PHP, mySQL, Apache, Perl, etc.
If I run this command from the prompt...
G> mysql -h db.torres.ws -u user
It connects fine.
If I do this from PHP...
$db_user = "user";
$db_pass = "";
$db_name = "myDB";
$db_host = 'db.torres.ws'; // '192.168.1.10'
mysql_connect($db_host, $db_user, $db_pass)
or die("Unable to connect to SQL server");
mysql_select_db($db_name)
or die("Unable to select database");
I get this...
Warning: mysql_connect(): Unknown MySQL Server Host
'db.torres.ws' (11001) in G:\home\php\htdocs\db.php
on line 12
But if I use the IP or 'localhost', it connects just fine.
BTW: db.torres.ws is in the HOSTS file on both machines.
This worked before. I had to reinstall the database and now it doesn't work.
Anyone have any ideas?
Thanks
Walter
| |
| Sebastian Lauwers 2004-07-24, 8:55 am |
| tried gethostbyname() ?
--
The most likely way for the world to be destroyed,
most experts agree, is by accident.
That's where we come in; we're computer professionals.
We cause accidents.
--Nathaniel Borenstein
|
|
|
|
|