function update_record($table, $input, $where, $check = 1) { if ($check == 1) { security::check_pin(); } $count = count($input); $i = 1; $sql = "UPDATE `{$table}` SET "; foreach ($input as $key => $value) { $sql .= "`{$key}` = '" . $value . "'"; if ($i++ < $count) { $sql .= ', '; } } $sql .= " WHERE {$where}"; $this->glob_update = $sql; // echo $sql; return $this->query($sql); }