CakeFest 2024: The Official CakePHP Conference

dba_nextkey

(PHP 4, PHP 5, PHP 7, PHP 8)

dba_nextkeyLit la clé DBA suivante

Description

dba_nextkey(resource $dba): string|false

dba_nextkey() retourne la clé suivante, dans la base identifiée par handle et incrémente le pointeur de clé.

Liste de paramètres

dba

Le gestionnaire de base de données, retourné par la fonction dba_open() ou la fonction dba_popen().

Valeurs de retour

Retourne la clé en cas de succès ou false si une erreur survient.

Voir aussi

add a note

User Contributed Notes 1 note

up
0
phpnet at araxon dot sk
1 year ago
It should be noted that it is not always safe to iterate through the database while changing it at the same time. For example:

<?php
$db
=dba_open(...);

// remove all values shorter than 10 characters
for ($key=dba_firstkey($db); $key!==false; $key=dba_nextkey($db)) {
$s=dba_fetch($key, $db);
if (
strlen($s)<10) {
dba_delete($key, $db);
}
}
?>

The above example will work fine with db4 handler, but not with gdbm. It is handler specific.
To Top