 <?php
// pieprasa rezultatu
$score = $_POST['score'];

// savienojas ar datu bazi
$servername = "localhost";
    $username = "root";
    $password = "";
    $database = "raimondsedvins_4110";


    $conn = new mysqli($servername, $username, $password, $database);
    if ($conn->connect_error) {
        die("Connection failed: " . $conn->connect_error);
    }
    
// Retrieve the id_record_num value
$id_record_num = $_POST['id_record_num'];

if (!empty($id_record_num)) {
    // Insert the id_record_num into the first row of the bouncing column
    $sql = "UPDATE games SET bouncing = '$id_record_num' LIMIT 1";
    if ($conn->query($sql) === TRUE) {
        echo "Record updated successfully.";
    } else {
        echo "Error updating record: " . $conn->error;
    }
} else {
    echo "No id_record_num value found.";
}

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