<?php
function format_date($t, $s, $f){ return date($f,t); }
$week =7*24*3600;
$fix = ( intval(format_date(ceil(time()/$week)*$week,'custom', 'd')) - intval(format_date(time(),'custom','d')) )*24*3600;
$sql = "select from_unixtime(ceil((created+$fix)/$week)*$week - $fix) date, count(*) from {node} where type='article' and status=1 group by date order by created desc limit 7";
print $sql;
Warning: Use of undefined constant t - assumed 't' (this will throw an Error in a future version of PHP) in /in/bFDqE on line 2
Warning: date() expects parameter 2 to be int, string given in /in/bFDqE on line 2
Warning: Use of undefined constant t - assumed 't' (this will throw an Error in a future version of PHP) in /in/bFDqE on line 2
Warning: date() expects parameter 2 to be int, string given in /in/bFDqE on line 2
select from_unixtime(ceil((created+0)/604800)*604800 - 0) date, count(*) from {node} where type='article' and status=1 group by date order by created desc limit 7
Output for 7.2.0 - 7.2.26
Warning: Use of undefined constant t - assumed 't' (this will throw an Error in a future version of PHP) in /in/bFDqE on line 2
Warning: date() expects parameter 2 to be integer, string given in /in/bFDqE on line 2
Warning: Use of undefined constant t - assumed 't' (this will throw an Error in a future version of PHP) in /in/bFDqE on line 2
Warning: date() expects parameter 2 to be integer, string given in /in/bFDqE on line 2
select from_unixtime(ceil((created+0)/604800)*604800 - 0) date, count(*) from {node} where type='article' and status=1 group by date order by created desc limit 7
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.33
Notice: Use of undefined constant t - assumed 't' in /in/bFDqE on line 2
Warning: date() expects parameter 2 to be integer, string given in /in/bFDqE on line 2
Notice: Use of undefined constant t - assumed 't' in /in/bFDqE on line 2
Warning: date() expects parameter 2 to be integer, string given in /in/bFDqE on line 2
select from_unixtime(ceil((created+0)/604800)*604800 - 0) date, count(*) from {node} where type='article' and status=1 group by date order by created desc limit 7
Notice: Use of undefined constant t - assumed 't' in /in/bFDqE on line 2
Warning: date() expects parameter 2 to be long, string given in /in/bFDqE on line 2
Notice: Use of undefined constant t - assumed 't' in /in/bFDqE on line 2
Warning: date() expects parameter 2 to be long, string given in /in/bFDqE on line 2
select from_unixtime(ceil((created+0)/604800)*604800 - 0) date, count(*) from {node} where type='article' and status=1 group by date order by created desc limit 7