php-gallery/app/image/edit_description.php

33 lines
1 KiB
PHP
Raw Normal View History

<?php
$conn_ip = "localhost";
$conn_username = "uwu";
$conn_password = "fennec621";
$conn_database = "swag";
$conn = mysqli_connect($conn_ip, $conn_username, $conn_password , $conn_database);
if ($conn->connect_error) {
// Send notification that connection couldn't be made
}
2022-08-07 09:59:27 +00:00
if (isset($_POST['submit'])) {
// getting ready forSQL asky asky
$sql = "UPDATE swag_table SET alt=? WHERE id=?";
2022-08-07 09:59:27 +00:00
// Checking if databse is doing ok
if ($stmt = mysqli_prepare($conn, $sql)) {
mysqli_stmt_bind_param($stmt, "si", $param_alt, $param_id);
2022-08-07 09:59:27 +00:00
// Setting parameters
$param_alt = $_POST['description'];
$param_id = $_POST['id'];
2022-08-07 09:59:27 +00:00
// Attempt to execute the prepared statement
if (mysqli_stmt_execute($stmt)) {
2022-08-07 17:28:21 +00:00
echo "sniffleAdd('Info', 'Description has been updated successfully! You may need to refresh the page to see the new information.', 'var(--green)', ".$root_dir."'assets/icons/check.svg')";
2022-08-07 09:59:27 +00:00
} else {
2022-08-07 17:28:21 +00:00
echo "sniffleAdd('Error', 'An error occured on the servers', 'var(--red)', ".$root_dir."'assets/icons/check.svg')";
}
}
}