Normalising names of tables

This commit is contained in:
Michał 2022-09-14 10:41:20 +00:00
parent 1472692ed5
commit 32e6a356a3
4 changed files with 9 additions and 9 deletions

View file

@ -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

View file

@ -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)) {

View file

@ -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

View file

@ -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