Change img

$maxFileSize) { die("File size exceeds the limit. Maximum allowed size is 1 MB."); } // Create a connection to the database $conn = new mysqli($servername, $username, $password, $db); // Check for connection errors if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } // Prepare the SQL statement to update the image $stmt = $conn->prepare("UPDATE inventory SET img = ? WHERE name = ?"); $stmt->bind_param("ss", $imageData, $name); // Execute the SQL statement if ($stmt->execute()) { echo "Image uploaded successfully."; } else { echo "Error uploading image."; } // Close the statement $stmt->close(); } ?>