<?php
$servername = "localhost";
$username = "earnxwca_teeffaa";
$password = "earnxwca_teeffaa";
$dbname = "earnxwca_teeffaa";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);

// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}

// Updated SQL query to fetch user_id, amount, offername, and offerwall with newest first
$sql = "SELECT user_id, amount, offerwall, offername FROM offerwall_history ORDER BY claim_time DESC"; // Assuming 'created_at' is the timestamp column
$result = $conn->query($sql);

// Check if the query was successful
if ($result === false) {
    die("Query failed: " . $conn->error);
}
?>
