Delete

Delete existing row(s) from a database table.


delete(string $table, array $filters)

Arguments

$table: string

Define a database table name to delete data from.

$filters: array

A collection of filters to apply to a query. The basic format is column[operator] => operand. The operand can be a string, number or an array containing multiple strings/numbers.

Sample Usage


// This is a simple DELETE example
try{
	// Delete an existing user from the users table whose ID is 104.
	$s = $squibble->delete('users', [
		'id[=]' => 104
	]);
	// Execute the delete query
	$deleted = $s->execute();
}catch(PDOException $e){
	echo "Error, {$e->getCode()}, {$e->getMessage()}";
}catch(Exception $e){
	echo "Error, {$e->getCode()}, {$e->getMessage()}";
}

Facebook
Twitter
LinkedIn