note 42696 deleted from ref.mssql by cmb
| From: | cmb@php.net | Date: | Sun, 28 Apr 2019 09:38:39 +0000 |
| Subject: | note 42696 deleted from ref.mssql by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-210691@lists.php.net to get a copy of this message | ||
Note Submitter: andrew at power-grid dot com
----
Ok, this took me a few days to get right but for those of you out there having a hard time with
getting PHP to talk to SQL 2000 this is for you! Personally for me the mssql plugin barely worked
with sql 2000 and was VERY slow, here's your solution and also some good code to connect
securely and quickly through ADO. I was having the worst time getting ADO to work as well, most
sites do the driver part a different way.. for me the code below is the only thing that worked.
<?php
$db = new COM("ADODB.Connection");
$dsn = "DRIVER={SQL Server}; SERVER={SERVER};UID={USER};PWD={PASS}; DATABASE={DB}";
$db->Open($dsn);
$rs = $db->Execute("SELECT * FROM table");
while (!$rs->EOF)
{
echo $rs->Fields['column']->Value."<BR>";
$rs->MoveNext();
}
?>