## db_swap_records

bool db_swap_records (string tablename, int id1, int id2 [, string idfield [, bool xchangeids]])

Swaps two records in a table.

Arguments

tablename is the name of the table that will be affected.
id1 is the id number of the first record to be exchanged.
id2 is the id number of the second record to be exchanged.
idfield is the name of identifier field (column). Default is "id".
xchangeids, if TRUE, exchanges the ids as well. Otherwise only the values are exchanged. The default is FALSE.

Result

The function returns TRUE if successful or FALSE otherwise.

Example

`// Exchange the first and third records in mytable db_swap_records("mytable", 1, 3);`

See also

Database functions
Database support