note 86983 deleted from pdo.prepare by danbrown

From: Date: Thu, 13 Nov 2008 15:08:12 +0000
Subject: note 86983 deleted from pdo.prepare by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-146486@lists.php.net to get a copy of this message
Note Submitter: said_r at hotmail dot com ---- using named parameters or place holders for the LIMIT clause with mysql leads to error i your sql statement: ex: $sth = $dbh->prepare('SELECT column FROM table WHERE somecondition limit :start , :offset ORDER BY column;'); $param = array('start'=> 1 , 'offset'=>5); $sth->execute($param); the error message looks something like this: ou have an error i your sql statement near '...LIMIT '1','5' ...' as you can see the limits are not numeric but they are quoted I also used the bindParam method with PDO::PARAM_INT to force the explicit data typing but in vain $sth->bindParam(':start', 1, PDO::PARAM_INT); $sth->bindParam(':offset', 5, PDO::PARAM_INT); this time an other error arises concerning the parametre passing to bindParam method I wish you try I may have made error somewhere but I want to know if you have ever faced such thing thanks

« previous php.notes (#146486) next »