The sql_replace() function inserts or updates a record in an SQL table. The primary key(s) must exist amongst the inserted data. The function automatically secures the data.

It is recommended to use the specific sql_insertq() and sql_updateq() instead of this function to be more precise, at least where such is possible.

Its 5 parameters are:

  1. $table is the SQL table in question,
  2. $couples contains the column/value pairs to be modified,
  3. $desc,
  4. $serveur,
  5. $option.

It is used as shown below:

sql_replace('table', array(
	'column' => 'value',
	'id_table' => $id

Author Mark Baber Published : Updated : 12/03/23

Translations : English, français