How to apply bindValue method in LIMIT clause?

后端 未结 10 2385
旧巷少年郎
旧巷少年郎 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:28

    I remember having this problem before. Cast the value to an integer before passing it to the bind function. I think this solves it.

    $fetchPictures->bindValue(':skip', (int) trim($_GET['skip']), PDO::PARAM_INT);
    

提交回复
热议问题