当语法正确时,MySQL会抛出语法错误

时间:2017-09-03 09:42:19

标签: php mysql

我有这段代码,应该从我的数据库表中一次检索10条记录:

$query = 'SELECT *
          FROM shares
          ORDER BY create_date DESC
          LIMIT :sharesPerPage OFFSET :lowerBound';
$this->prepare($query);
$this->bind(':sharesPerPage', $sharesPerPage);
$this->bind(':lowerBound', $lowerBound);
$this->execute();

出于某种原因,PDO异常被抛出了我的错误语法信息' 10' OFFSET' 0',分别对应$sharesPerPage$lowerBound

我已经检查了所有内容,但查询仍然评估为错误。该代码有什么问题?

1 个答案:

答案 0 :(得分:2)

你必须将你的价值转换为int。否则它将转换为字符串

ggplot(T0.modified,
       aes(x = reference.year, y = Price, group = Company, color = Company)) +
  geom_line(aes()) +
  xlab("Year") + theme_bw() + 

  stat_summary(fun.y = mean, geom = "line", group = 1,
                 linetype = 2, size = 1.5, colour = "grey") +
  annotate("label", x = 7, y = 200, label = "Average", 
           fill = "grey", alpha = 0.5, hjust = 1)