From 32e6a356a39b029f925fe5138eb92b1c87fefaf0 Mon Sep 17 00:00:00 2001 From: Fluffy-Bean <michal-gdula@protonmail.com> Date: Wed, 14 Sep 2022 10:41:20 +0000 Subject: [PATCH] Normalising names of tables --- app/app.php | 2 +- app/image/image.php | 8 ++++---- app/image/upload_image.php | 2 +- index.php | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/app.php b/app/app.php index ce0d1a9..577bab3 100644 --- a/app/app.php +++ b/app/app.php @@ -97,7 +97,7 @@ class Image { */ function get_image_info($conn, $id) { // Setting SQL query - $sql = "SELECT * FROM swag_table WHERE id = ".$id; + $sql = "SELECT * FROM images WHERE id = ".$id; // Getting results $query = mysqli_query($conn, $sql); // Fetching associated info diff --git a/app/image/image.php b/app/image/image.php index fbd05ac..3cd13af 100644 --- a/app/image/image.php +++ b/app/image/image.php @@ -27,7 +27,7 @@ if (isset($_POST['submit_delete'])) { // If user owns image or has the ID of 1 if ($image_info->image_privilage($image_array['author']) || $_SESSION['id'] == 1) { // Delete from table - $sql = "DELETE FROM swag_table WHERE id = ?"; + $sql = "DELETE FROM images WHERE id = ?"; if ($stmt = mysqli_prepare($conn, $sql)) { mysqli_stmt_bind_param($stmt, "i", $param_id); @@ -100,7 +100,7 @@ if (isset($_POST['submit_description'])) { // If user owns image or has the ID of 1 if ($image_info->image_privilage($image_array['author']) || $_SESSION['id'] == 1) { // getting ready forSQL asky asky - $sql = "UPDATE swag_table SET alt=? WHERE id=?"; + $sql = "UPDATE images SET alt=? WHERE id=?"; // Checking if databse is doing ok if ($stmt = mysqli_prepare($conn, $sql)) { @@ -161,7 +161,7 @@ if (isset($_POST['submit_tags'])) { $tags_string = $make_stuff->tags(trim($_POST['input'])); // getting ready forSQL asky asky - $sql = "UPDATE swag_table SET tags=? WHERE id=?"; + $sql = "UPDATE images SET tags=? WHERE id=?"; // Checking if databse is doing ok if ($stmt = mysqli_prepare($conn, $sql)) { @@ -217,7 +217,7 @@ if (isset($_POST['submit_author'])) { // If user has the ID of 1 if ($user_info->is_admin($_SESSION['id'])) { // getting ready forSQL asky asky - $sql = "UPDATE swag_table SET author=? WHERE id=?"; + $sql = "UPDATE images SET author=? WHERE id=?"; // Checking if databse is doing ok if ($stmt = mysqli_prepare($conn, $sql)) { diff --git a/app/image/upload_image.php b/app/image/upload_image.php index 8c7d19c..18a519e 100644 --- a/app/image/upload_image.php +++ b/app/image/upload_image.php @@ -57,7 +57,7 @@ if (isset($_POST['submit'])) { } // Prepare sql for destruction and filtering the sus - $sql = "INSERT INTO swag_table (imagename, alt, tags, author) VALUES (?, ?, ?, ?)"; + $sql = "INSERT INTO images (imagename, alt, tags, author) VALUES (?, ?, ?, ?)"; if ($stmt = mysqli_prepare($conn, $sql)) { // Bind the smelly smelly diff --git a/index.php b/index.php index a1bf01d..8c2a4be 100644 --- a/index.php +++ b/index.php @@ -7,8 +7,8 @@ <body> <?php -require_once __DIR__."/ui/required.php"; -require_once __DIR__."/ui/nav.php"; + require_once __DIR__."/ui/required.php"; + require_once __DIR__."/ui/nav.php"; ?> <script> @@ -55,7 +55,7 @@ require_once __DIR__."/ui/nav.php"; <div class="gallery-root"> <?php // Reading images from table - $image_request = mysqli_query($conn, "SELECT * FROM swag_table ORDER BY id DESC"); + $image_request = mysqli_query($conn, "SELECT * FROM images ORDER BY id DESC"); while ($image = mysqli_fetch_array($image_request)) { // Getting thumbnail