<?php
// include("../db.php");
// header('Content-Type: application/json');

$servername = "localhost";
$username = "timepulse_epush";
$password = "techno@123";
$database = "timepulse_epush";

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

// Check connection
if ($conn->connect_error) {
    echo "Connection Failed.";
}
else { 
    // echo "Connected successfully";
}

$sql = "SELECT * FROM aa_users order by id desc limit 1 ";
$result = $conn->query($sql);

// $currentdate = date('Y-m-d');

if ($result->num_rows > 0) {
    while($row = $result->fetch_assoc()) {
        // print_r($row);
        echo "<pre>";
        print_r($row);
        echo "</pre>";
        
        $sql = "update aa_count set last_id='$row[id]' ";
        
        if ($conn->query($sql) === TRUE) {
          echo "New record created successfully";
        }
        
    }
}


?>