Cannot update with same value

This commit is contained in:
Gregorio Chiko Putra 2017-09-06 14:48:47 +07:00
parent 35947befc1
commit bb834494bd

View File

@ -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);