Prepared statement in PHP/HTML website doesn't write to database but works in php-myAdmin : I have to write a html/php News-Website where you can add news if you're logged in, the news get sent to a MySQL Database and from there I want them to be displayed on the website. The problem right now is that although my prepared statement is beeing executed and all the variables are filled with the right values, the data doesn't get written to the SQL table. I tried using the same query as the prepared statement but not as a prepared statement but with the values typed out and it worked perfectly. I am very confused an would love some help from you guys.

<!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-html -->

    <!DOCTYPE html>
    <html>
    <head>
    <title>News hinzufügen</title>

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <link rel="stylesheet" type="text/css" href="stylesheet.css">

    <script src="https://cloud.tinymce.com/5/tinymce.min.js"></script>
    <script>tinymce.init({ selector:'textarea' });</script>

    </head>
    <body>
    	<form action="add_news.php" method="POST" enctype="multipart/form-data">
    		<input type="text" name="title" placeholder="Titel" class="titlestyle" required="required">
    		<select name="kategorie" class="kategoriestyle">
    			<option value="1">Kategorie 1</option>
    			<option value="2">Kategorie 2</option>
    			<option value="3">Kategorie 3</option>
    		</select>
    		Gültig von <input type="date" name="vondate"> bis <input type="date" name="bisdate" required="required">
    		<textarea name="news" class="textareastyle" required="required">	
    		</textarea>
    		<input type="file" name="imageUpload" id="imageUpload">
    		<input type="text" name="bildbeschreibung" placeholder="Beschreiben Sie Ihr Bild"> <br>
    		<input type="text" name="link" placeholder="Link">
    		<input type="text" name="linkbeschreibung" placeholder="Beschreiben Sie Ihren Link" > <br>
    		<input type="submit" name="submit" value="Fertigstellen" class="submitstyle">
    	</form>






    </body>




    </html>



<!-- end snippet -->

And here is the PHP-Code:


    <?php session_start();	?>
    <link rel="stylesheet" type="text/css" href="stylesheet.css">
    <?php
    $dbserver = 'localhost';
    $dbusername = 'root';
    $dbpassword = '';
    $dbname = 'm151db';
    $titel = "";
    $text = "";
    $kategorie;
    $vondatum = "";
    $bidatum = "";
    $bild = "";
    $bildbeschr = "";
    $link = "";
    $linkbeschr = "";
    
    
    $autor = $_SESSION["username"];
    $error = "";
    
    if (isset($_POST['submit'])) {
    
    		$conn = mysqli_connect($dbserver, $dbusername, $dbpassword, $dbname);
    
    		if ($conn->connect_error) {
    			die('Connection Error: Es gab ein Problem mit dem Verbindungsaufbau. ('.$conn->connect_errno.')'.$conn->connect_error);
    		} 
    
    
    		$stmt = $conn->prepare("INSERT INTO news (name, beschreibung, kategorie_id, von, bis, bild, bildbeschreibung, link, linkbeschreibung, author) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
    
    		$stmt->bind_param("ssssssssss", $titel, $text, $kategorie, $vondatum, $bisdatum, $bild, $bildbeschr, $link, $linkbeschr, $autor);
    
    		if(isset($_POST['title'])) {
    			$titel = trim($_POST['title']);
    			echo "$titel";
    			
    		}
    
    		if(isset($_POST['news'])) {
    			$text = trim($_POST['news']);
    			echo "$text";
    		}
    
    		if(isset($_POST['kategorie'])) {
    			$katerorie = $_POST['kategorie'];
    			echo "$kategorie";
    		}
    
    		if(isset($_POST['vondate'])) {
    			$vondatum = $_POST['vondate'];
    			echo "$vondatum";
    		}
    
    		if(isset($_POST['bisdate'])) {
    			$bisdatum = $_POST['bisdate'];
    			echo "$bisdatum";
    		}
    
    		if(isset($_POST['bildbeschreibung'])) {
    			$bildbeschr = trim($_POST['bildbeschreibung']);
    			echo "$bildbeschr";
    		}
    
    		if(isset($_POST['link'])) {
    			$link = trim($_POST['link']);
    			echo "$link";
    		}
    
    		if(isset($_POST['linkbeschreibung'])) {
    			$linkbeschr = trim($_POST['linkbeschreibung']);
    			echo "$linkbeschr";
    		}
    
    
    
    		
    
    
    	if(isset($_FILES['imageUpload'])) {
    
    		echo "0";
    
    		$target_dir = "uploads/";
    
    		$target_file = $target_dir . basename($_FILES["imageUpload"]["name"]);
    
    		$uploadOk = 1;
    		$imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
    
    		
    			
    			$check = getimagesize($_FILES["imageUpload"]["tmp_name"]);
    
    			if($check == true) {
    				
    				$uploadOk = 1;
    				echo "1";
    			}
    
    			else {	?>
    				<div class="alertbox">
    				<span class="closebtn"onclick="this.parentElement.style.display='none';">&times;</span>
    				Es können nur Bilddateien hochgeladen werden.
    				</div>
    		<?php		$uploadOk = 0;
    			}
    		
    
    		if(file_exists($target_file)) {	?>
    			<div class="alertbox">
    				<span class="closebtn"onclick="this.parentElement.style.display='none';">&times;</span>
    				Dieses Bild wurde bereits hochgeladen.
    				</div>
    		<?php	$uploadOk = 0;
    		}
    
    		if($_FILES["imageUpload"]["size"] > 500000) {  ?>
    			<div class="alertbox">
    				<span class="closebtn"onclick="this.parentElement.style.display='none';">&times;</span>
    				Das Bild ist zu gross. Wähle ein Bild unter 500kb aus.
    				</div>
    		<?php	$uploadOk = 0;
    		}
    
    		if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg") { ?>
    			<div class="alertbox">
    				<span class="closebtn"onclick="this.parentElement.style.display='none';">&times;</span>
    				Wähle ein PNG-/JPG-/JPEG-Bild aus.
    				</div>
    		<?php	$uploadOk = 0;
    		}
    
    		if($uploadOk == 0) {  ?>
    			<div class="alertbox">
    				<span class="closebtn"onclick="this.parentElement.style.display='none';">&times;</span>
    				Es ist ein Fehler beim hochladen ihres Bildes aufgetreten. Versuchen sie es erneut.
    				</div>
    		<?php 
    		}
    		else {
    			if(move_uploaded_file($_FILES["imageUpload"]["tmp_name"], $target_file)) {
    				//echo "The file has been uploaded.";
    			}
    			else {   ?>
    				<div class="alertbox">
    				<span class="closebtn"onclick="this.parentElement.style.display='none';">&times;</span>
    				Es ist ein Fehler beim hochladen ihres Bildes aufgetreten. Versuchen sie es erneut.
    				</div>
    			<?php }
    
    
    
    
    
    			$bild = $target_file;
    			echo "$bild";
    		}
    
    
    	$stmt->execute();
    
    	if ($stmt == true) {
    			
    			echo "stmt executed";
    		}
    
    		else {
    			echo "stmt not executed";
    			
    		}
    	}
    }
    
    ?>

PS: The echos are just checkpoints so that I see what was executed and what wasn't.