Bug #17875 Updated: sizeof() reports double the elements for an mssql_fetch_array

From: Date: Thu, 20 Jun 2002 16:30:38 +0000
Subject: Bug #17875 Updated: sizeof() reports double the elements for an mssql_fetch_array
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-11581@lists.php.net to get a copy of this message
ID: 17875 Updated by: cusaacb@squared.com Reported By: cusaacb@squared.com Status: Bogus Bug Type: Arrays related Operating System: Linux PHP Version: 4.2.1 New Comment: OK. I see. If you want to just iterate over the fields you would use mssql_fetch_row() instead. Sorry and Thanks, Previous Comments: ------------------------------------------------------------------------ [2002-06-20 12:07:41] sander@php.net Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php "mssql_fetch_array() is an extended version of mssql_fetch_row(). In addition to storing the data in the numeric indices of the result array, it also stores the data in associative indices, using the field names as keys." ------------------------------------------------------------------------ [2002-06-20 11:56:14] cusaacb@squared.com // correct behavior $arr = array(); $arr[0] = "One"; $arr[1] = "Two"; $arr[2] = "Three"; print "Normal:&nbsp&nbsp&nbsp"; print sizeof($arr) . "<BR><BR>"; //show bug $rs = mssql_query("select '1' as one, '2' as two, '3' as three from tablename"); $sqlarr = mssql_fetch_array($rs); print "Bug:&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp"; //----- HERES THE BUG print sizeof($sqlarr) . "\n"; ./configure --prefix=/usr/local/php --with-sybase=/usr/local/freetds --with-pgsql=/usr/local/pgsql --with-apxs2=/usr/local/apache2/bin/apxs ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=17875&edit=1

« previous php.bugs (#11581) next »