i have int
data in database t_calibrator (calperiod = 12, 24 and 36) of months and i want to calculate with my input date in $callast
,
this my created code (but always get 1970-01-01):
$calperiod = mysqli_query($conn, "SELECT calperiod FROM t_calibrator WHERE id_calibrator='$id_calibrator'");
$add = date('Y-m-d', strtotime('+".$calperiod" month', strtotime($callast)));
my reference code get from $add = date('Y-m-d', strtotime('+24 month', strtotime($callast)));
and yes that works but only for 24 month.
UPDATE now i try with this code :
$sql = "SELECT * FROM t_calibrator WHERE id_calibrator = '$id_calibrator'";
$result = mysqli_query ($conn,$sql);
$caldata = mysqli_fetch_array ($result);
$add = date('Y-m-d', strtotime('+".$caldata['calperiod']." months', strtotime($callast)));
But showing error like this :
Parse error: syntax error, unexpected 'calperiod' (T_STRING), expecting ',' or ')' in /storage/h7/747/1148747/public_html/pages/calinputhistory.php on line 19
can any one help my this trouble? (sorry for my bad english)