PEAR::DB replacement class

Contents

The limitedQuery() Method

This method is best used for updates, where you don't want to make daft mistakes that destroy all your data (I've done that before :( ).

<?php
    $db->limitedQuery("UPDATE users SET password = 'foo' WHERE id = 8");
?>

Here, the limitedQuery() function will add a limit clause to the query so it actually becomes: UPDATE users SET password = 'foo' WHERE id = 8 LIMIT 1

You can also specify a second argument to the method which specifies the upper most limit of the query (this many rows aren't forced to be updated).

<?php
    $db->limitedQuery("UPDATE users SET password = 'foo' WHERE id = 8", 2);
?>