Click to See Complete Forum and Search --> : how to connect to a db server using php?


Anon
07-12-2001, 10:18 AM
hi.

I am a newbie. We have a database server on the network along with an IIS (MS Internet Information server)server. We have PhP installed on IIS. What would the db connection parameters look like if I wanted to connect to our DB server. The database server name is USABASE.

would it be...

<?
$servername="Usabase";
$user="xxxx";
$pw="xxxxxxx";

mssql_connect($servername,$user,$pw) or die ("Access denied");
?>
-----
Is it alright if I just reference the servername? or do I need to reference anything else besides the servername (such as Ip address, port number. etc..)?

Thank you in advance,
David

Anon
07-16-2001, 06:19 AM
If your webserver and mysql are on the same computer, it would look something loke this:

$variable_to_store_result = mysql_connect("localhost", "user", "pass");

(keep the quotes)


if they are on different machines:

$variable_to_store_result = mysql_connect("ip address of machine running mysql", "user", "pass");