I keep getting this syntax error in my MySQL code within a PHP file. I'm simply trying to increment/add to the value already in the table with this time variable. If anyone could help me out I'd greatly appreciate it.
$sql = "UPDATE Aircraft
SET MaintenanceFlightTime = (MaintenanceFlightTime + $MaintenanceDuration),
WHERE AircraftID = $AircraftID";
UPDATE Aircraft SET MaintenanceFlightTime = (MaintenanceFlightTime + 00:10:00), WHERE AircraftID = 8
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 ':10:00), WHERE AircraftID = 8' at line 2
You cannot just add a string like '01:01:01' to a time column but you can use
$MaintenanceDuration = '00:10:00'; $sql = "UPDATE Aircraft SET MaintenanceFlightTime = ADDTIME(MaintenanceFlightTime, '$MaintenanceDuration') WHERE AircraftID = $AircraftID";