note 15557 modified in ref.mssql by zak
| From: | zak@php.net | Date: | Mon, 17 Sep 2001 23:15:59 +0000 |
| Subject: | note 15557 modified in ref.mssql by zak | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-18095@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\)
4.) Edit your php.ini file (most likely in c:\WINNT\) to uncomment the call to the php_mssql.dll. It
should look like this:
...
;extension=php_mhash.dll
;extension=php_ming.dll
extension=php_mssql.dll
;extension=c:\winnt\system32\php_mssql70.dll
;extension=php_oci8.dll
...
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;
?>
That should do it!
http://www.php.net/manual/en/ref.mssql.php