note 15557 added to ref.mssql
| From: | laurence at cweb dot org | Date: | Mon, 17 Sep 2001 19:18:36 +0000 |
| Subject: | note 15557 added to ref.mssql | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-18085@lists.php.net to get a copy of this message | ||
How I got MSSQL functions to work on WinNT workstation with PWS:
1.) (If you don't have PHP installed already...) Download and install windows PHP installer
(PHP 4.0.6 installer) from http://php.net/downloads.php
2.) Download the windows binary files (PHP 4.0.6 zip package) from http://php.net/downloads.php
3.) Unzip php_mssql.dll from the file you downloaded in step 2, and copy it to your PHP extensions
directory (most likely c:\Php\extensions\)
You should be able to test it by running the following code. Obviously, you need to replace your
hostname, username, and password.
<?
$hostname = "hostname";
$username = "username";
$password = "password";
mssql_connect($hostname,$username,$password) or DIE("DATABASE FAILED TO RESPOND.");
$query = "SELECT name FROM sysobjects WHERE xtype = 'U' ";
$result = MSSQL_QUERY($query);
$number = MSSQL_NUM_ROWS($result);
$i=0;
if ($number == 0) :
print "No data?";
elseif ($number > 0) :
print "Data:";
while ($i < $number) :
$name = mssql_result($result,$i,"Name");
print $name;
echo("<br><br>");
print "
";
$i++;
endwhile;
endif;
?>
http://www.php.net/manual/en/ref.mssql.php