Incompatibility or bug?

From: Date: Sat, 13 Nov 1999 12:12:00 +0000
Subject: Incompatibility or bug?
Groups: php.version4 
Request: Send a blank email to php-version4+get-6167@lists.php.net to get a copy of this message
I don't really know what to make of this... Here's the smallest test case I could come up with: <? function db_array($f, $t, $order, $min, $max) { global $db; $q = sybase_query(" SELECT $f FROM $t WHERE $order BETWEEN $min and $max ORDER BY $order ", $db); $i = 0; while ($a = sybase_fetch_array( $q )) { $r[$i] = $a["$f"]; print "\n<BR>$a[$f]\n<BR>\n"; $i++; } if (is_array($r)) return $r; return 0; } $names = db_array( "INTEREST_NAME", "INTERESTS", "INTEREST_ID", 5, 21); print "<PRE>"; var_dump($names); print "</pre>"; ?> (Obviously, you would need to change the args to db_array()...) Inside the "while" loop, the proper names are printed out. Once I leave the while loop, if I do var_dump, etc on $r, I get: array(17) { int(0) i:0 int(1) i:0 int(2) i:0 ... IE, the elements of the array have all lost their values! The keys are still there, but the values are not. I have witnessed this behavior in CVS as of this afternoon and in b3-RC4. --Joey Smith

« previous php.version4 (#6167) next »