More on sybase-ct and losing array data
| From: | Joey | Date: | Mon, 15 Nov 1999 23:56:03 +0000 |
| Subject: | More on sybase-ct and losing array data | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-12583@lists.php.net to get a copy of this message | ||
After digging in the source for awhile (thank heavens for lxr.php.net!),
I'm pretty sure that my problem is not in sybase-ct module, per se.
Here is a recap:
<?
function foo()
{
global $db;
$q = sybase_query("SELECT foo FROM bar where foo > foo2", $db);
while ($a = sybase_fetch_array($q))
{
$retval[] = $a["foo"]; // A
}
var_dump($retval); // B
if (is_array($retval))
return $retval;
else
retrun 0;
}
$n = foo();
var_dump($n);
?>
A: I have tried several variations on this, like doing a for loop, etc.
Everything is fine as long as I am in the loop, but once I pass out
of the loop, I lose all the values of my array. ie, B ends up with
array(size)
{
int(0):
int(1): 0
.
.
.
int(size):
int(1): 0
}
But size is correct.
But I only see this behavior in sybase_fetch_array (ie,
mysql_fetch_array() worked fine...)
If anyone has any ideas where I could begin looking, I;d love to track
this one down. I compared php_sybase_fetch_hash to php_mysql_fetch_hash,
and the are basically the same, so I can't see what is going wrong here...
is this stuff being freed where it shouldn't? Something in the garbage
collector, perhaps?
--Joey Smith