I am working with php
. My reservation
table structure:
Now I am trying to update an entry with the following code:
<?php
include('function.php');
$BUS_NO = $_POST["BUS_NO"];
$PNR_NO = $_POST["PNR_NO"];
$NEW_NO_OF_SEATS = $_POST["NO_OF_SEATS"];
$NEW_ADDRESS = $_POST["ADDRESS"];
$NEW_CONTACT_NO = $_POST["CONTACT_NO"];
$sql = "UPDATE 'reservation' SET 'NO_OF_SEATS'=$NEW_NO_OF_SEATS, 'ADDRESS'=$NEW_ADDRESS, 'CONTACT_NO'=$NEW_CONTACT_NO WHERE `PNR_NO` = $PNR_NO";
$result = $conn->query($sql);
if ($conn->query($sql) === TRUE) {
echo "Record updated successfully";
}
else {
echo "Error updating record: " . $conn->error;
}
?>
But It says the following error:
Error updating record: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''reservation' SET 'NO_OF_SEATS'=11190, 'ADDRESS'=221B Baker Street, 'CONTACT_NO'' at line 1
How can I fix this?