note 8588 added to mssql_fetch_array

From: Date: Wed, 20 Sep 2000 05:11:33 +0000
Subject: note 8588 added to mssql_fetch_array
Groups: php.notes 
Request: Send a blank email to php-notes+get-5205@lists.php.net to get a copy of this message
When using PHP(4) on a NT box connecting to MS-SQL, and if you do the following: // assume we have a connection already... $sQuery = "SELECT Keyword FROM KeywordTable"; $iQueryResult = mssql_query($sQuery); $oTestArray = array(); while ($oThisRow = mssql_fetch_array($iQueryResult)) { $oTestArray[] = $oThisRow["Keyword"]; } $iCount = count($oTestArray); for ($i=0; $i<$iCount; $i++) { echo ($oTestArray[$i] . "<br>\n"); } Then you get some VERY weird output! It seems that problem with the returned array from mssql_fetch_array. You MUST do this in order to get correct string value in $oTestArray: $oTestArray[] = strval($oThisRow["Keyword"]); I think this is a bug, since the fetch_array works as the way it should under MySQL. http://www.php.net/manual/function.mssql-fetch-array.php

« previous php.notes (#5205) next »