//无法使用代码
require ('../catalog/view/theme/default/template/config/dbconfig.php');
$stmt1=$DB_CON->prepare('select count(*) as t,sum(total) as total,CAST(date_added as DATE) as date_added from oc_order where date_added>DATE_SUB(NOW(),INTERVAL 1 WEEK) group by CAST(date_added as DATE) order by date_added DESC');
$stmt1->execute();
$record1=$stmt1->fetchAll(PDO::FETCH_ASSOC);
var_dump($record1);
但上面的查询是在phpmyadmin中工作,它正确地返回数据但它在php中的pdo中不起作用。即使它是相同的查询
,下面的代码也能很好地工作//工作代码 - >当我选择1个月的数据时
$stmt1=$DB_CON->prepare('select count(*) as t,sum(total) as total,CAST(date_added as DATE) as date_added from oc_order where date_added>DATE_SUB(NOW(),INTERVAL 1 MONTH) group by CAST(date_added as DATE) order by date_added DESC');
$stmt1->execute();
$record1=$stmt1->fetchAll(PDO::FETCH_ASSOC);
var_dump($record1);
有什么方法可以解决这个问题吗?