Main Page | Class Hierarchy | Data Structures | Directories | File List | Data Fields | Related Pages

simple_counter.php

00001 <?php
00002 // Create a new Db4 Instance
00003 $db = new Db4();
00004 
00005 // Open it outside a Db4Env environment with datafile/var/lib/db4 
00006 // and database name "test"
00007 $db->open(null, "/var/lib/db4", "test");
00008 
00009 // Get the current value of "counter"
00010 $counter = $db->get("counter");
00011 print "Counter Value is $counter";
00012 
00013 // Increment $counter and put() it.
00014 $db->put("counter", $counter+1);
00015 // Sync to be certain, since we're leaving the handle open
00016 $db->sync();
00017 ?>

Generated on Sun Dec 25 12:14:43 2005 for Berkeley DB 4.4.16 by  doxygen 1.4.2