Mysql Raw Query Missing Data
Mysql Raw Query Missing Data
Hi,
i m using internal engine to push my own query, whereas my query should give me (and give my a lot of result _ 48 in the exemple) FetchAll return only 1 result
this query get one date by month during 4 years
$years = 4;
$result = $db->raw()
->bind( ":years", $years )
->exec("WITH RECURSIVE dates(Date) AS
(
SELECT DATE(now()) as Date
UNION ALL
SELECT DATE(DATE_ADD(Date, INTERVAL 1 month)) FROM dates WHERE Date < DATE(DATE_ADD(now(), INTERVAL :years year))
)
SELECT DATE(Date) FROM dates
");
$result->fetchAll(PDO::FETCH_ASSOC);
any clues ?
Thanks
This question has an accepted answers - jump to answer
Answers
ok my bad, i frogot to init $years in my code
it works perfectly
Thanks for the update - good to hear you got it working!
Allan