I'm trying to decrease a counter variable (x) within this date function:
date('Y-m-d', strtotime(x days'))
in a while loop like this:
$Today = date('Y-m-d', strtotime('-1 days'));
output thus far: 2015-06-25
$x = -1;
while ($row = mysql_fetch_array($result1)) {
$Today = date('Y-m-d', strtotime('$x days'));
...
$x = $x - 1;
}
desired output on next iteration of while loop: 2015-06-24 and so on ...
What you have already will work, except that it has to be done with a double quoted string to interpolate the variable, as in strtotime("$x days")
– @Michael Berkowski