When i use an int (id= 1) in WHERE clause it works but not as a string variable (id= $id)
<?php
$conn=mysqli_connect('localhost','root','','htmscontrol');
$Device_id = $_POST['Device_id'];
$id = $_POST['id'];
$sql = "UPDATE identity SET Device_id = '$Device_id' WHERE id= $id "
if (mysqli_query($conn, $sql)) {
echo "Record updated successfully";
} else {
echo "Error updating record: " . mysqli_error($conn);
}
$conn->close();
header("Location: header.php");
?>