note 83196 deleted from function.mssql-connect by danbrown
| From: | danbrown@php.net | Date: | Sun, 07 Dec 2008 19:08:03 +0000 |
| Subject: | note 83196 deleted from function.mssql-connect by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-147849@lists.php.net to get a copy of this message | ||
Note Submitter: cajunzerangue
----
Current setup IIS 5.1 (Windows XP) / PHP 5.26 (including PECL 5.26 extensions) / MS SQL Server 2000
The following code worked flawlessly for me. (Borrowed from http://www.webcheatsheet.com/PHP/connect_mssql_database.php)
<?php
$myServer = "ServerName\ServerInstance";
$myUser = "dbuser";
$myPass = "dbpassword";
$myDB = "DBName";
// connection to the database
$dbhandle = mssql_connect($myServer, $myUser, $myPass)
or die("Couldn't connect to SQL Server on $myServer");
// select a database to work with
$selected = mssql_select_db($myDB, $dbhandle)
or die("Couldn't open database $myDB");
echo "You are connected to the " . $myDB . " database on the " . $myServer .
".";
// close the connection
mssql_close($dbhandle);
?>
ALSO, it's important to note that I did have to replace the ntwdblib.dll that was included with
my PHP 5.2.6 source, and replace it with the latest version which you can find on http://www.webzila.com/?wz=dll.