<?php
// update-time.php

// Assuming you have a database connection established
$conn = mysqli_connect('localhost', 'root', '', 'raimondsedvins_4110');

if (!$conn) {
  die('Database connection failed: ' . mysqli_connect_error());
}


if (isset($_POST['time'])) {
  $newTime = intval($_POST['time']);

  // Perform the database update query
  $sql = "UPDATE games SET bouncing = $newTime WHERE id = 1"; // Assuming you want to update the first row with ID 1
  $result = mysqli_query($conn, $sql);

  if ($result) {
    echo 'Time updated successfully';
  } else {
    echo 'Failed to update time: ' . mysqli_error($conn);
  }
}

// Close the database connection
mysqli_close($conn);
?>