note 42698 deleted from ref.mssql by nlopess
| From: | nlopess@php.net | Date: | Wed, 26 May 2004 16:34:08 +0000 |
| Subject: | note 42698 deleted from ref.mssql by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-70129@lists.php.net to get a copy of this message | ||
Note Submitter: andrew@power-grid.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.
<?
$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();
}
?>