How to apply bindValue method in LIMIT clause?

后端 未结 10 2428
旧巷少年郎
旧巷少年郎 2020-11-21 04:28

Here is a snapshot of my code:

$fetchPictures = $PDO->prepare(\"SELECT * 
    FROM pictures 
    WHERE album = :albumId 
    ORDER BY id ASC 
    LIMIT :s         


        
10条回答
  •  遥遥无期
    2020-11-21 05:30

    //BEFORE (Present error) $query = " .... LIMIT :p1, 30;"; ... $stmt->bindParam(':p1', $limiteInferior);

    //AFTER (Error corrected) $query = " .... LIMIT :p1, 30;"; ... $limiteInferior = (int)$limiteInferior; $stmt->bindParam(':p1', $limiteInferior, PDO::PARAM_INT);

提交回复
热议问题