I would like to update table data on user input without a where clause. I tried using the code below, but it shows "500 Internal server error"
form code (test1.php):
<html>
<form action="anja.php" method="get">
<p>Essen: <input type="text" name="ess1" /></p>
<p>Essen: <input type="text" name="ess2" /></p>
<p><input type="submit" value="update" /></p>
</form>
</html>
update data code (anja.php):
</html>
<?php
require 'inc/db.php';
$ess1 = $_GET['ess1'];
$ess2 = $_GET['ess2'];
$data = [
'ess1' => $ess1,
'ess2' => $ess2
];
{
$sql ="UPDATE essenplan SET ess1='$ess1'";"UPDATE essenplan SET ess2='$ess2'";
$stmt= $pdo->prepare($sql);
$stmt->execute($data);
}
?>
</html>
database connection code (db.php) :
<?php
$pdo = new PDO('mysql:host=hfpsql.bandstahl.local;dbname=essenmenue', 'essen', 'c1AzGm4oMqO0RiB7');
?>
Thanks in advance!