Coding with SPIP 2.1
SPIP 2.1 Technical Documentation

> > > > sql_replace_multi

sql_replace_multi

The sql_replace_multi() function is used to insert or replace several rows (which have the same schema) for an SQL table in a single operation. The values are automatically filtered against SQL injection attacks. It is necessary that the columns of inserted pairs contain the primary key(s) for that table.

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

It has the same 5 parameters as sql_replace :

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

It is used as shown below:

  1. sql_replace_multi('table', array(
  2. 'column' => 'value1',
  3. 'id_table' => $id1
  4. ),
  5. 'column' => 'value2',
  6. 'id_table' => $id2
  7. )
  8. ));

Download

  • Author :
  • Published :
  • Updated : 01/06/10
  • Translations : English, français