note 42696 added to ref.mssql
| From: | andrew at power-grid dot com | Date: | Wed, 26 May 2004 16:11:49 +0000 |
| Subject: | note 42696 added to ref.mssql | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-70124@lists.php.net to get a copy of this message | ||
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();
}
?>
----
Manual Page -- http://www.php.net/manual/en/ref.mssql.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+42696
Delete -- http://master.php.net/manage/user-notes.php?action=delete+42696&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+42696&report=yes
Search -- http://master.php.net/manage/user-notes.php