note 42696 modified in ref.mssql by danbrown

From: Date: Mon, 18 May 2009 02:14:35 +0000
Subject: note 42696 modified in ref.mssql by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-155639@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. <?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(); } ?> --was-- 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(); } ?> http://php.net/manual/en/ref.mssql.php

« previous php.notes (#155639) next »