D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
self
/
root
/
proc
/
self
/
root
/
home
/
markniuj
/
bazmeasar.com
/
admin
/
Filename :
edit-audio.php
back
Copy
<?php include "../config.php"; ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Edit Audio File</title> <link rel="stylesheet" href="css.css"> </head> <body> <header> <div class="logo"><img src="logo.png"></div> </header> <div class="mainbody"> <div class="bodyarea"> <h1>Admin Page</h1> <!-- Add a link to add a new audio file --> <p><a href="addaudio.php">Add New Audio File</a></p> <!-- Display audio files with edit and delete options --> <table> <tr> <th>Bayyan Name</th> <th>Date</th> <th>Speaker</th> <th>Edit</th> <th>Delete</th> </tr> <?php // Pagination settings $limit = 999; // Number of records per page $page = (isset($_GET['page']) && is_numeric($_GET['page'])) ? $_GET['page'] : 1; $offset = ($page - 1) * $limit; // Query to select audio files with pagination $query = "SELECT * FROM audio_files ORDER BY id DESC LIMIT $offset, $limit"; $result = $conn->query($query); if ($result && $result->num_rows > 0) { while ($row = $result->fetch_assoc()) { $audio_id = $row["id"]; $english_title = $row["english_title"]; $a_date = $row["a_date"]; $speaker = $row["speaker"]; echo "<tr>"; echo "<td>$english_title</td>"; echo "<td>$a_date</td>"; echo "<td>$speaker</td>"; echo "<td><a href='edit_audio.php?id=$audio_id'>Edit</a></td>"; echo "<td><a href='delete_audio.php?id=$audio_id'>Delete</a></td>"; echo "</tr>"; } } else { echo "<tr><td colspan='4'>No records found.</td></tr>"; } // Close the database connection $conn->close(); ?> </table> <!-- Pagination links --> <div class="pagination"> <?php // Calculate the total number of pages $total_records = mysqli_num_rows(mysqli_query($conn, "SELECT id FROM audio_files")); $total_pages = ceil($total_records / $limit); // Display pagination links for ($i = 1; $i <= $total_pages; $i++) { echo "<a href='admin.php?page=$i'>$i</a>"; } ?> </div> </div> </div> <footer> <a href="https://webograph.pk/">Site BY Webograph.pk</a> </footer> </body> </html>