Web студия "GrandView"
  Главная   Написать Контакты
   
   
О проекте
Руководство php
 

dbmnextkey

(PHP 3, PHP 4, PECL)

dbmnextkey -- 

Описание

string dbmnextkey ( resource dbm_identifier, string key )

Returns the next key after key.

Список параметров

dbm_identifier

The DBM link identifier, returned by dbmopen().

key

The previous key

Возвращаемые значения

The next key if possible

Примеры

By calling dbmfirstkey() followed by successive calls to dbmnextkey() it is possible to visit every key/value pair in the dbm database. For example:

Пример 1. Visiting every key/value pair in a DBM database

<?php

$key
= dbmfirstkey($dbm_id);
while (
$key) {
    echo
"$key = " . dbmfetch($dbm_id, $key) . "\n";
   
$key = dbmnextkey($dbm_id, $key);
}

?>

Смотрите также

dbmfirstkey()



dbmopen> <dbminsert
Last updated: Sat, 27 Jan 2007
 
add a note add a note User Contributed Notes
dbmnextkey
fischer at schlund dot de
19-Mar-2001 10:08
When you have a key "0" or so in your DB, then the example don't works, because "while ($key)" will return false for 0 ...
I had good experiences with "while (strlen($key)>0)" as condition ... because when we have the last key false is returned and false evaluates to "nothing" ...
fred at ontosys dot com
12-Oct-2000 10:41
dbmnext() seems to lose the thread if the program deletes keys as it walks through all rows.  I imagine that something similar happens with inserts.  One way around this is to make two passes:  one to collect the keys and one to manipulate the rows.  For example:

$old_keys = array();
for ($key = dbmfirstkey($db); $key; $key = dbmnextkey($db, $key)) {
  $old_keys[] = $key;
}
while (list($_, $key) = each($old_keys)) {
    dbmdelete($db, $key);
}
hiongun at kt dot co dot kr
08-Oct-1999 07:52
$key = dbmnextkey($dbm_id, $key) returns
"" on the second call.
karutla at hotmail dot com
01-Oct-1999 04:14
$key = dbmfirstkey($dbm_id);
while ($key) {
    dbmreplace($dbm_id, $value);
    $key = dbmnextkey($dbm_id, $key);
}

doesn't seem to iterate through all the records properly.

dbmopen> <dbminsert
Last updated: Sat, 27 Jan 2007
 
 
Новости
11 июля 2007
Сайт запущен
© 2007 info@grandviewstudio.com

Deprecated: Function set_magic_quotes_runtime() is deprecated in /home/sites/grandviewstudiocom/www/65f67d67a94ad980786580ae69e11c07/sape.php on line 324

Deprecated: Function set_magic_quotes_runtime() is deprecated in /home/sites/grandviewstudiocom/www/65f67d67a94ad980786580ae69e11c07/sape.php on line 330
Z058440144362 Z348613067571