hello,

i'm soooooo frustrated i've wasted the last 7 hours trying to connect to a ms sql database with php. this is the first time i've tried php on an IIS server and it's been a nightmare so far 🙁
the sql server is on another computer on our network so i copied the connection string from one of our ASP applications.

could someone please help me connect to it? heres' my code:

<?php

$myServer = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=clientWebsite;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;User Id=sa;"; 

$myUser = "sa"; 

$myPass = ""; 

$myDB = "clientWebSite";

$s = mssql_connect($myServer, $myUser, $myPass) 

or die("Couldn't connect to SQL Server on $myServer");

$d = mssql_select_db($myDB, $s) 

or die("Couldn't open database $myDB");

if (!$connection) { 
        echo "Couldn't make a connection!"; 
        exit; 
    } 
else {
print ("all is well");
}

?>

thanks for reading this,
- sprite

    example
    host = 172.16.20.81
    port = 1433

    $myserver variable should have somethig for the style:

    $myserver="172.16.20.81:1433";

    you have to find out what is the IP of the other machine
    it's all i can do for you.
    sorry.

      Write a Reply...