Hey guys, so I've been trying to create a website that allows users to update and delete records through the database I've set up in SQLyog. In my update confirmation file I've added location theme description to be updated and changed for all users. but for some reason its unable to add new data to that database and does not give me an error so I've got no idea what's wrong with my update php file. Any help will be greatly appreciated
<?php
$title = "Update Confirmation";
include('includes/header.inc');
include('includes/nav.inc');
require_once('includes/config.inc');
require_once('includes/DbController.inc');
echo "<div id='message'>";
$error = false;
if (!empty($_POST['id'])) {
$db = new DbController(HOST, USER, PASS, DB);
foreach ($_POST as $key => $val) {
$$key = trim($val);
}
$sql = "UPDATE places SET Location=?, theme=?, description=? WHERE placeid=?";
$stmt = $db->prepare($sql);
$stmt->bind_param("sssi", $location, $theme, $description, $id);
if ($stmt->execute()) {
echo "<p>Record $id updated</p>";
} else {
echo "<p>Error updating record: " . $stmt->error . "</p>";
$error = true;
}
} else {
$error = true;
}
if ($error) {
echo "<p>Record is NOT updated.</p>";
}
echo "</div>";
include('includes/footer.inc');
?>