<?php 
include("database.php");
?>


<?php

$sql = "SELECT * FROM pdf_files ORDER BY created_at DESC";
$result = $conn->query($sql);

$output = "";
$number = 1; // Start numbering from 1

while ($row = $result->fetch_assoc()) {
    $output .= "<tr>
        <td>{$number}</td> <!-- Numeric Serial Number -->
        <td>{$row['website_name']}</td>
        <td><a href='{$row['pdf_file']}' target='_blank'>View PDF</a></td>
        <td><a href='view.php?url={$row['unique_url']}' target='_blank'>Open Flipbook</a></td>
    </tr>";
    $number++; // Increment serial number
}

echo $output;
$conn->close();
?>
