autoPrepare() build automaticaly an insert or an update sql query and call prepare() with it. The sql query is build by using an ordered array containing fields names.
name of the table
ordered array containing the fields names
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 | The ordered array, which has to contain fields names, is empty. | Check and correct your fields names 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.