Abscissa Tech Home Design Coding Media Server
Tutorials Courses Forums Resources
  Home
 
  Member Options
    Sign Up
  Log In
 
  Tools
    PowerHTML
    Teacher's Lounge
  References
  HTML
  PHP
  CSS
 
  Search
 
 
    Legalese
    Contact Us
    Privacy Policy
    About Abscissa

XI. dbm functions

These functions allow you to store records stored in a dbm-style database. This type of database (supported by the Berkeley db, gdbm, and some system libraries, as well as a built-in flatfile library) stores key/value pairs (as opposed to the full-blown records supported by relational databases).

Example 1. dbm example

  1 
  2 $dbm = dbmopen("lastseen", "w");
  3 if (dbmexists($dbm, $userid)) {
  4   $last_seen = dbmfetch($dbm, $userid);
  5 } else {
  6   dbminsert($dbm, $userid, time());
  7 }
  8 do_stuff();
  9 dbmreplace($dbm, $userid, time());
 10 dbmclose($dbm);
 11 

Table of Contents
dbmopen — opens a dbm database
dbmclose — closes a dbm database
dbmexists — tells if a value exists for a key in a dbm database
dbmfetch — fetches a value for a key from a dbm database
dbminsert — inserts a value for a key in a dbm database
dbmreplace — replaces the value for a key in a dbm database
dbmdelete — deletes the value for a key from a dbm database
dbmfirstkey — retrieves the first key from a dbm database
dbmnextkey — retrieves the next key from a dbm database
dblist — describes the dbm-compatible library being used

This PHP manual is Copyright © 1997, 1998, 1999, 2000 the PHP Documentation Group. It has been licensed under the GPL. Permission granted for display on the Abscissa Tech web site on March 9, 2000. The most recent PHP documentation is available at http://www.php.net/.