autoExecute() build automaticaly an insert or an update sql query and call prepare() and execute() with it. The sql query is build by using autoPrepare(). To call autoExecute, you need only an assoc (key => value) where keys are fields names and values are corresponding values of these fields.
name of the table
assoc (key => value), keys are fields names, values are values of these fields
type of query to make (DB_AUTOQUERY_INSERT or DB_AUTOQUERY_UPDATE)
in case of update queries, this string will be put after the WHERE statement
Table 20-1. Possible PEAR_Error values
Error code | Error message | Reason | Solution |
---|---|---|---|
DB_ERROR_NEED_MORE_DATA | NULL | Your associative array, which has to contain fields names and their values, is empty. | Check and correct your fields_values array. |
DB_ERROR_SYNTAX | NULL | You use an unknown mode. | Available modes are only DB_AUTOQUERY_INSERT for "insert queries" or DB_AUTOQUERY_UPDATE for "update queries". |
DB_ERROR_NO_DB_SELECTED | NULL | No database was choosen. | Check the DSN in connect(). |
every other error code | Database specific error | Check the database related section of PHP-Manual to detect the reason for this error. |
This function can not be called statically
See Introduction - autoPrepare and autoExecute for general using and an example.