note 100283 modified in book.mssql by danbrown

From: Date: Wed, 06 Oct 2010 14:47:53 +0000
Subject: note 100283 modified in book.mssql by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-173016@lists.php.net to get a copy of this message
Using the new MS driver I have come across a difference between the array that I get back compared to mssql. Example is here (both return types are associative arrays: sqlsrv_fetch_array($resource, SQLSRV_FETCH_ASSOC) "same as" sqlsrv_fetch($resource), as this returns by default an associative array, by default sqlsrv_fetch_array returns both an associative and a numeric array. returns... array(6) { ["yaxis"]=> object(DateTime)#58 (3) { ["date"]=> string(19) "2010-09-29 00:00:00" ["timezone_type"]=> int(3) ["timezone"]=> string(19) "Australia/Melbourne" } ["xaxis"]=> string(7) "Inbound" ["tt"]=> int(280345) ["ht"]=> int(297219) ["wt"]=> int(16874) ["calls"]=> int(1539) } string(8) "" mssql_fetch_assoc($resource) returns array(6) { ["yaxis"]=> string(19) "2010-09-29 00:00:00" ["xaxis"]=> string(7) "Inbound" ["tt"]=> int(280345) ["ht"]=> int(297219) ["wt"]=> int(16874) ["calls"]=> int(1539) } string(8) "" it would be much too difficult to change a large number of applications to compensate for this. Found my answer... add this to your connection objects parameters on instantiation "ReturnDatesAsStrings"=>true Found it buried in this article: http://msdn.microsoft.com/en-us/library/ee376928(SQL.90).aspx --was-- Found my answer... add this to your connection objects parameters on instantiation "ReturnDatesAsStrings"=>true Found it buried in this article: http://msdn.microsoft.com/en-us/library/ee376928(SQL.90).aspx http://php.net/manual/en/book.mssql.php

« previous php.notes (#173016) next »