Page 1 of 1

adding date variable to an int variable....

Posted: Sat Sep 14, 2002 11:42 am
by DynamiteHost
Any idea why this code doesnt work? $amount can be anything between 1 and 12. When I try to put it into a mysql db table, it simply leaves the field empty.

Code: Select all

$day = date("d");
if ($timescale == "monthly") {
$month = date("m");
$month+$amount;
}
else {
$year = date("y");
$year+$amount;
}

Thanks all :D

Posted: Sat Sep 14, 2002 12:08 pm
by hob_goblin
try something more like

Code: Select all

$day = date("d"); 
if ($timescale == "monthly") { 
$month = date("m"); 
$value = $month+$amount; 
} 
else { 
$year = date("y"); 
$value = $year+$amount; 
}
and the information will be stored in '$value', you were adding them, just not putting the returned value into anything.

Posted: Sat Sep 14, 2002 12:18 pm
by DynamiteHost
Thanks for the help, it worked 8)