dpb_4431 2017-03-11 18:57
浏览 27

我有一个语法错误,它没有意义[重复]

I don't know why but i have a syntax error, my code looks completely fine to me,

$page = $_POST['page'];
$amount = $_POST['amount'];



$Realpage = intval($page);
$Realamount = intval($amount);
$query = $con->prepare(
   "SELECT 
      * 
    FROM 
      store 
    AS 
      s
    INNER JOIN 
      product_pictures AS pp 
    ON 
      s.product_id = pp.id 
    INNER JOIN 
      product_name AS pn 
    ON 
      s.product_id = pn.id 
    WHERE 
      (s.product_price BETWEEN :firstPrice AND :secondPrice) AND 
      product_name LIKE :input LIMIT :page , :amount ");

$query->execute(array(':input' => "%" . $input . "%" , ":firstPrice" => intval($firstPrice), ":secondPrice" => intval($secondPrice) , ':page' => $Realpage * $Realamount, ':amount' => $Realamount));

Error:

Fatal error: Uncaught exception 'PDOException' with message '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 ''0' , '20'' at line 1'

</div>
  • 写回答

1条回答 默认 最新

  • douyi8315 2017-03-11 19:06
    关注

    LIMIT and PAGE in your SQL cannot be part of statement preparation.

    评论

报告相同问题?

悬赏问题

  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大