$new_data = $app->request->put(); // //============= Validate data $valid = new Validation(); if (!$valid->validate('name', $new_data['name'])) { http_response_code(400); echo json_encode(array('error' => $valid->msg)); die; } //============ // End validate data //overwrite old data $old_data = $db->select($table_set, "id", $id); $new_data['update_on'] = $current_date; $data = array_merge($old_data[0], $new_data); // execute query $result = $db->update($table_set, "id", $id, $data); // response data echo json_encode($data); }); // DELETE:: delete card $app->delete('/set/:id', function ($id) { if (!$id) { http_response_code(400); echo json_encode(array('error' => 'id is not empty!')); die; } global $db, $table_set; $app = \Slim\Slim::getInstance(); $app->response()->header("Content-Type", "application/json"); if (!$id) { http_response_code(400);