DB_common::autoPrepare()

DB_common::autoPrepare()

DB_common::autoPrepare() --  Prepares an INSERT or UPDATE statement based on variables you supply

Description

Automatically builds an INSERT or UPDATE SQL statement so it can later be used by execute() or executeMultiple().

Parameter

string $table

name of the table

array $table_fields

ordered array containing the fields names

Be aware that these fields are assigned ? placeholders, therefore the data you pass to them in the execute() will be automatically escaped and quoted according to the current DBMS's requirements.

integer $mode

type of query to make (DB_AUTOQUERY_INSERT or DB_AUTOQUERY_UPDATE)

string $where

a string to be used in the WHERE clause. This is only used when $mode is DB_AUTOQUERY_UPDATE. The string is put directly into the query, so you must escape and quote literals according to the DBMS's standards.

Return value

resource - resource handle for the query or a DB_Error object on failure

Note

This function can not be called statically.

© Copyright 2003-2023 www.php-editors.com. The ultimate PHP Editor and PHP IDE site.