Stuck! GDBM not listing my whole database!?

From: Date: Thu, 06 Jul 2000 04:55:10 +0000
Subject: Stuck! GDBM not listing my whole database!?
Groups: php.general 
Request: Send a blank email to php-general+get-5158@lists.php.net to get a copy of this message
Hello PHP People, I'm new to this lovely language, and I'm growing quite attached. BUT.. ;) I have a GDBM database of around 50 or so key/value pairs. I know all these pairs exist because I can see them in the binary database file, AND I can read the values on them when I name the exact key I wish to read. HOWEVER, when I walk through the directory to list all the contents, it only lists 7 of them, and my listing loop quits early having reached the apparent "end". Why would GDBM and/or PHP not be listing the whole database? Here's my listing routine: $dbm = dbmopen("/www/db", "r"); $key = dbmfirstkey($dbm); while ($key) {
    print $key."<BR>";
    $key = dbmnextkey($dbm, $key);
} After the loop exits, $key = "". What's really weird is if I place a SECOND dbmnextkey() after the first, it'll move on happily. It's almost like it's actually finding a $key named "" (nothing), which is triggering the end of the loop early even though there's really more data to be discovered. dblist() returns "This is GDBM version 1.8.0, as of May 19, 1999." SO MANY THANKS in advance. This is the only thing that's tripping me up in my PHP adventure! Regards, Cabel Panic

« previous php.general (#5158) next »