Bir veritabanını güncelleştirmek için pdo kullanmaya çalışıyorum, kod hiçbir hata döndürmüyor ancak kod çalışmıyor. Mantık, kullanıcının kullanıcı kimliğine girmesi ve daha sonra yeni bir konum vuruşu göndermesi ve konumun güncellenmesidir. İşte php formu veritabanı güncellenmiyor
formu kodudur:<html>
<head>
<title>Web Dev 1</title>
</head>
<body>
<form method="post" action="update.php">
Patient location by ID: <input type="text" id="Patid" name="Patid" /><br />
Location: <input type="text" id="Location" name="Location" /><br />
<input type="submit" name = 'action' value="update" />
</html>
Bu güncelleme kodu:
<?php
error_reporting(E_ALL);
ini_set('display_errors',1);
$host = "localhost";
$user ="sbuser";
$db = "mdb";
$pass ="lamepassword";
$conn = new PDO($dsn, $user, $password);
$sqlInsert = 'UPDATE lobby set Location=:Location where Patid=:Patid';
$preparedStatement = $conn->prepare($sqlInsert);
$preparedStatement->execute(array(':Patid' => '$_POST[Patid]', ':Location' = $_POST[Location]');
}
?>
bazı hata var? –
Bir yan notda, kod örneğinde '