Page 1 of 1

Help with PHP to mysql connection.

Posted: Wed Sep 17, 2008 10:29 pm
by onedollartotown
Hi Guys,

I need help on connecting my php website to the mysql database. My mysql database is located on my webhosting server.

First I need to sftp(login) to my web server, followed by ssh(login) to my database server, the ip is 192.168.XXX.XXX. This database is located in /home/mywebsite/

The question is how do I code my php so that I can connect to my server. I cannot get it to work with localhost nor using the ip. The error I get is "Unable to connect to MySQL".

Help greatly appreciated. If I have missed any useful information do let me know.

Thanks,
John

Re: Help with PHP to mysql connection.

Posted: Thu Sep 18, 2008 10:30 am
by Bill H

Code: Select all

 
$Host = "xxxxxx";               // server name
$User = "xxxxxx";              // database param
$Password = "xxxxxx";      // database param
$Link = mysql_connect($Host, $User, $Password);
 
You'll need to get the three parameters from youe webhost.