10.7. Modifying Data in a SQL Database10.7.2. SolutionWith PEAR DB, use DB::query( ) to send an INSERT, DELETE, or UPDATE command:
You can also prepare a query with DB::prepare( ) and execute it with DB::execute( ):
10.7.3. DiscussionThe query( ) method sends to the database whatever it's passed, so it can be used for queries that retrieve data or queries that modify data. The prepare( ) and execute( ) methods are especially useful for queries that you want to execute multiple times. Once you've prepared a query, you can execute it with new values without re-preparing it:
10.7.4. See AlsoRecipe 10.4 for connecting to a SQL database; Recipe 10.5 for querying a SQL database; Recipe 10.8 discusses prepare( ) and execute( ) in detail; documentation on DB::query( ) at http://pear.php.net/manual/en/core.db.query.php, DB::prepare( ) at http://pear.php.net/manual/en/core.db.prepare.php, and DB::execute( ) at http://pear.php.net/manual/en/core.db.execute.php.
Copyright © 2003 O'Reilly & Associates. All rights reserved. |
|