Db::delete
Usage
void Db::delete(string $table_name, object | string $where_clause, [ ... $args ])Description
Delete one or more records within a database table.Parameters
Parameter | Required | Type | Description |
---|---|---|---|
$table_name | Yes | string | The table name to delete records from. |
$where_clause | Yes | object | string | Can either be an object instance, or a string being the where clause which may also contain placeholders (ie. %s, %i, %b, et al) |
$args | No | desc= |
Examples
Delete with where Clause
// Delete all inactive products less than $35
$price = 35.00;
$this->db->delete('products', 'is_active = %b AND price < %d', false, $price);
echo "Deleteed necessary rows\n";