professional-php-08-new-DB-test.php / php
<?php require_once('class.Database.php'); try { e) { // No point continuing... die("Unable to connect to the database."); } count = sql); print "There are <br>\n"; // start a transaction db->startTransaction(); // do an insert and an update try { arValues['id'] = '#id#'; newID = arValues); print "The new record has the ID <br>\n"; // update the record we just created arUpdate = array(); affected = arUpdate, "id = affected records<br>\n"; // write the changes to the database e) { // some sort of error happened - abort the transaction // and print the error message <br>\n" . e->getMessage(); } ?>
(C) Æliens 20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.