php - How to apply bindValue method in LIMIT clause? -




here snapshot of code:

$fetchpictures = $pdo->prepare("select *      pictures      album = :albumid      order id asc      limit :skip, :max");  $fetchpictures->bindvalue(':albumid', $_get['albumid'], pdo::param_int);  if(isset($_get['skip'])) {     $fetchpictures->bindvalue(':skip', trim($_get['skip']), pdo::param_int);     } else {     $fetchpictures->bindvalue(':skip', 0, pdo::param_int);   }  $fetchpictures->bindvalue(':max', $max, pdo::param_int); $fetchpictures->execute() or die(print_r($fetchpictures->errorinfo())); $pictures = $fetchpictures->fetchall(pdo::fetch_assoc); 

i

you have error in sql syntax; check manual corresponds mysql server version right syntax use near ''15', 15' @ line 1

it seems pdo adding single quotes variables in limit part of sql code. looked found bug think related: http://bugs.php.net/bug.php?id=44639

is i'm looking at? bug has been opened since april 2008! supposed in meantime?

i need build pagination, , need make sure data clean, sql injection-safe, before sending sql statement.

i remember having problem before. cast value integer before passing bind function. think solves it.

$fetchpictures->bindvalue(':skip', (int) trim($_get['skip']), pdo::param_int); 




wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -