D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
markniuj
/
bazmeasar.com
/
pdf
/
Filename :
update_record.php
back
Copy
<?php include "../config.php"; ?> <meta content="width=device-width, initial-scale=1.0" name="viewport"> <?php // Check if the form is submitted if ($_SERVER["REQUEST_METHOD"] == "POST") { // Retrieve data from the form $id = $_POST['id']; $bookName = $_POST['book_name']; $bookAuthor = $_POST['book_author']; $description = $_POST['description']; $pdfCategory = $_POST['pdf_category']; // Prepare and execute the SQL update statement $updateQuery = "UPDATE pdf_books SET book_name = '$bookName', book_author = '$bookAuthor', description = '$description', pdf_category = '$pdfCategory' WHERE id = $id"; if ($conn->query($updateQuery) === TRUE) { echo "Record updated successfully!"; echo "<br>"; echo "<a href='index.php'><button>Go Back</button></a>"; } else { echo "Error updating record: " . $conn->error; } // Close the database connection $conn->close(); } else { echo "Invalid request. Please submit the form."; } ?>