DB::autoPrepare()

DB::autoPrepare() -- Build automaticaly an insert or an update sql query and call prepare() with it.

Description

resource autoPrepare (string $table, array $table_fields, integer $mode [, string $where])

autoPrepare() requires an ordered array like :
array('field1', 'field2', 'field3', ...)
and will make an sql query like (insert mode) :
"INSERT INTO $table (field1,field2,field3,...) VALUES (?,?,?)"
or (update mode) :
"UPDATE $table SET field1=?,field2=?,field3=?,... WHERE $where"
Then, prepare() is called with this query.

There is two modes :

DB_AUTOQUERY_INSERT - build insert queries
DB_AUTOQUERY_UPDATE - build update queries

Be carefull, when you make update queries, if you don't specify $where argument, all the records will be updated.

Parameter

Returns