Cannot update with same value
This commit is contained in:
parent
35947befc1
commit
bb834494bd
@ -144,6 +144,19 @@ abstract class Model
|
|||||||
try {
|
try {
|
||||||
$db = static::connectDB();
|
$db = static::connectDB();
|
||||||
|
|
||||||
|
$result = $this->showAll();
|
||||||
|
|
||||||
|
foreach ($result as $post) {
|
||||||
|
foreach ($post as $key => $val) {
|
||||||
|
if (isset($args[$key])) {
|
||||||
|
if ($args[$key] == $post[$key]) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$sql = "UPDATE {$table} SET {$fields} WHERE id = ?";
|
$sql = "UPDATE {$table} SET {$fields} WHERE id = ?";
|
||||||
|
|
||||||
$query = $db->prepare($sql);
|
$query = $db->prepare($sql);
|
||||||
|
Loading…
Reference in New Issue
Block a user