'Failed to connect to MySQL: ' . mysqli_connect_error())); exit; } if ($input['action'] === 'edit') { $mysqli->query("UPDATE users SET username='" . $input['username'] . "', email='" . $input['email'] . "', avatar='" . $input['avatar'] . "' WHERE id='" . $input['id'] . "'"); } else if ($input['action'] === 'delete') { $mysqli->query("UPDATE users SET deleted=1 WHERE id='" . $input['id'] . "'"); } else if ($input['action'] === 'restore') { $mysqli->query("UPDATE users SET deleted=0 WHERE id='" . $input['id'] . "'"); } mysqli_close($mysqli); echo json_encode($input);