News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

PHPro.org:
SQLite-ON DUPLICATE KEY UPDATE
November 10, 2008 @ 12:58:18

This new tutorial on the PHPro.org website shows how to implement a common database feature, ON DUPLICATE KEY UPDATE, in a SQLite database with PHP.

SQLite is an ultra lite database replacement that comes bundled with PHP. Because of its light weight it lacks many of the features found in more robust applications such as MySQL, PostgresQL and others. One of the features that is lacking is the ON DUPLICATE KEY UPDATE that is often used to automatically UPDATE a record, should a duplicate field be found. Here a demonstration is provided to duplicate this behaviour using PHP Exceptions.

Their example creates a table of animals and inserts several to act as a base. They show insert method, how to get the information back out and what happens when you try add a duplicate value to the table. Normally this just results in an exception being displayed but, when caught with exception handling, it can be redirected into an update statement to change that animal's current information.

0 comments voice your opinion now!
tutorial exception sqlite update duplicate key


blog comments powered by Disqus

Similar Posts

Tony Lukasavage's Blog: PHP Debugging on IntelliJ IDEA 10 with Xdebug

PHPBuilder.com: Refactor Your PHP Site Using MySQL Procedures and Views

Symfony Blog: Symfony Docs Hack Day Needs You on March 30th

NETTUTS.com: How to Update your Twitter Status with CodeIgniter

Pádraic Brady's Blog:Doing that thing called PEAR - Packaging Source Code for PEAR Distribution


Community Events





Don't see your event here?
Let us know!


tips framework language opinion laravel podcast developer conference symfony bugfix series introduction interview community api release library deployment list zendserver

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework