mirror of
https://codeberg.org/vlw/php-mysql.git
synced 2025-09-13 16:23:42 +02:00
fix: set WHERE for DELET statement only if conditions are provided
This commit is contained in:
parent
ddcd8a2961
commit
dfd800e263
1 changed files with 7 additions and 2 deletions
|
@ -268,9 +268,14 @@
|
|||
$this->throw_if_no_table();
|
||||
|
||||
// Set DELETE WHERE conditions from arguments
|
||||
$this->where(...$conditions);
|
||||
if ($conditions) {
|
||||
$this->where(...$conditions);
|
||||
}
|
||||
|
||||
$sql = "DELETE FROM `{$this->table}` WHERE {$this->filter_sql}";
|
||||
// Get array of SQL WHERE string and filter values
|
||||
$filter_sql = !is_null($this->filter_sql) ? " WHERE {$this->filter_sql}" : "";
|
||||
|
||||
$sql = "DELETE FROM `{$this->table}`{$this->filter_sql}";
|
||||
return $this->execute_query($sql, self::to_list_array($this->filter_values));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue