I have a table called TABLE_ENTREGAS with 4 fields
id
fecha_entrega
fecha_preparacion
fecha_facturacion
Where fecha_entrega
is a data already inserted I call it with a variable $fecha_entrega
it contains a data in datetime: 2017-07-03 12:38:35
now well
-
fecha_preparacion
must insert 4 days before the$fecha_entrega
-
fecha_facturacion
must insert 4 days after the$fecha_entrega
This update is the one I have for fecha_preparacion
tep_db_query("update " . TABLE_ENTREGAS . " set fecha_preparacion = '" . date_sub($fecha_entrega,INTERVAL 4 DAY) . "' where entregas_id = '" . (int)$entregas_id . "'");
This is 4 days less but the update gives me the following error:
Parse error: syntax error, unexpected '4' (T_LNUMBER)
1- I do not know what the error is
2- I do not know if adding + or - to 4 to define 4 days before or 4 days after