Hola amigos tengo el siguiente formulario, me genera error cuando intento insertar el input time con los datos del formulario, que puedo estar haciendo mal
<form action="workingtime.php" method="post">
<input type="hidden" value="L" name="name_l">
<input type="time" name="from_l" value="<?php echo date("H:i", strtotime('01:00 AM'));?>" class="form-control">
</form>
*** "working_time.php"
if (!empty($_POST['from_l'])) {
$from_l = $_POST['from_l'];
$name_l = $_POST['name_l'];
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sql_l = "UPDATE working_time SET from='$from_l' WHERE name='$name_l'";
if($db->exec($sql_l)){
echo 'Ok';
}else{
echo 'Error';
};
}
Este es el error
PHP Fatal error: Uncaught PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'from='01:00' WHERE name='L'' at line 1 in /var/www/html/your6/controllers/workingtime.php:23\nStack trace:\n#0 /var/www/html/your6/controllers/workingtime.php(23): PDO->exec('UPDATE working_...' –