Source for file replace.php

Documentation is available at replace.php

  1. <?php
  2. /**
  3. * Replace Example
  4. *
  5. * This example show how to use the Replace method.
  6. * @package AbstractDB
  7. * @author Pacific-Cybersoft
  8. * @copyright (C) 2005 Pacific-Cybersoft. All Rights Reserved.
  9. * @version v 1.0.2
  10. * @license http://www.gnu.org/copyleft/lesser.txt GNU Lesser General Public License
  11. */
  12.  
  13. /**
  14. * Include the AbstractDB main class.
  15. */
  16. include("../abstractdb.class.php");
  17.  
  18. // Instatiate AbstractDB
  19. $db = new AbstractDB(array("ConnectionString"=>"mysql://username:password@localhost/mydatabase"));
  20.  
  21. $fields = array(
  22. "PrimaryKeyField"=>array("Type"=>"numeric", "Key"=>true, "Value"=>1, "Null"=>false),
  23. "Field2"=>array("Type"=>"text", "Key"=>false, "Value"=>"replaced value", "Null"=>false),
  24. "Field3"=>array("Type"=>"text", "Key"=>false, "Value"=>"", "Null"=>true));
  25.  
  26. // Execute a REPLACE Query
  27. if(!$db->Replace("tablename", $fields))
  28. die($db->GetLastError());
  29. // Always good practice to close AbstractDB at the end of each script.
  30. $db->Close();
  31. ?>

Documentation generated on Wed, 16 Mar 2005 23:17:28 +1100 by phpDocumentor 1.3.0RC3