db_save

Handy db insert/update operation

Parameters
string $table

The table name without prefix

#
array $data = []

The array of data field names and values

#
int $id = 0

The value for ID field to update

#
boolean $useSlug = true

TRUE to include the slug field or FALSE to not exclude it The fourth argument can be provided here if you want to omit this.

#
array $condition = []

The condition for the UPDATE query. If you provide this, the first field of $data will not be built for condition

#
Returns
bool|int|mixed

For insert, returns inserted id on success or FALSE on failure; For update, returns updated id on success or FALSE on failure