This topic is locked
[SOLVED]

 Add a year to a field

6/18/2018 6:17:02 AM
PHPRunner General questions
P
PaulM author

I'm trying to add a year to a field but get an error
$values("OGO_end_date")=date_add($values["OGO_start_date"], INTERVAL 1 YEAR)
syntax error, unexpected '1' (T_LNUMBER) in line 1
Whats wrong?

M
mersintarim 6/18/2018



I'm trying to add a year to a field but get an error
$values("OGO_end_date")=date_add($values["OGO_start_date"], INTERVAL 1 YEAR)
syntax error, unexpected '1' (T_LNUMBER) in line 1
Whats wrong?


wrong

$values("OGO_end_date")
correct

$values["OGO_end_date"]

P
PaulM author 6/18/2018

Thank you, I changed it
$values["OGO_end_date"]=date_add($values["OGO_start_date"], INTERVAL 1 YEAR)
but still get the error:
syntax error, unexpected '1' (T_LNUMBER) in line 1

M
mersintarim 6/19/2018

you taking this error which events?

lefty 6/20/2018



you taking this error which events?


Try this
$values["OGO_end_date"]=date_add($values["OGO_start_date"], strtotime('+1 YEAR')); // php event

P
PaulM author 7/4/2018



Try this
$values["OGO_end_date"]=date_add($values["OGO_start_date"], strtotime('+1 YEAR')); // php event


Thanks John, thaat works