0

My code look like:

$sql = '
SELECT ads.ad_id 
  FROM ads_day_by_day 
  LEFT 
  JOIN ads 
    ON ads_day_by_day.ad_id = ads.ad_id 
 WHERE ads_day_by_day.date >= ? 
   AND ads_day_by_day.date <= ? 
 GROUP 
    BY ads_day_by_day.ad_id 
 LIMIT ?';
$statement = $this->em->getConnection()->prepare($sql);
$statement->execute($from, $to, 10]);
$ads = $statement->fetchAllAssociative();

And I get the following error:

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''10'' at line 1

Could you let me know what I am doing wrong? Why I am getting this type of error? It is very important to use positional argument, no named!

Strawberry
  • 33,750
  • 13
  • 40
  • 57
miclofa
  • 49
  • 1
  • 10

0 Answers0