Problem with NULLs and sybase_fetch_row

From: Date: Mon, 11 Dec 2000 18:26:08 +0000
Subject: Problem with NULLs and sybase_fetch_row
Groups: php.db 
Request: Send a blank email to php-db+get-5152@lists.php.net to get a copy of this message
I've gotr a Digital Unix box running Apache 1.3.12, FreeTDS 0.50, and PHP 4.0.3pl1 (using the sybase-ct libs) talking to our MSSQL server (7.0), and have noticed a problem with sybase_fetch_row and NULL values. When a NULL is encountered, the array returned by sybase_fetct_row seems to "inherit" the last non-NULL value from a previous call to sybase_fetch_row. For testing purposes I created a small database with 3 columns (a,b,c) with the following data (columns are varchar 50): 1 2 3 10 20 30 NULL 200 300 1000 NULL 3000 10000 20000 NULL NULL NULL I've got a bit of code that connects does a "SELECT a,b,c FROM TABLE1", then uses a while $data = sybase_fetch_array($query) to loop through the results and dump the data. I get the following results -- notice the repeated values (i.e. 3000) where the above table has NULL. Empty strings are OK; it's just NULL that causes a problem. 1 2 3 10 20 30 10 200 300 1000 200 3000 10000 20000 3000 20000 3000 Has anyone seen this before? I'd appreciate _any_ suggestions or tips. I can post my PHP code if people think that's of benefit. Thanx, - Darryl ---------------------------------------------------------------------- Darryl Friesen, B.Sc., Programmer/Analyst Darryl.Friesen@usask.ca Education & Research Technology Services, http://gollum.usask.ca/ Department of Computing Services, University of Saskatchewan ---------------------------------------------------------------------- "Go not to the Elves for counsel, for they will say both no and yes"

« previous php.db (#5152) next »