note 86983 added to pdo.prepare

From: Date: Thu, 13 Nov 2008 12:00:22 +0000
Subject: note 86983 added to pdo.prepare
Groups: php.notes 
Request: Send a blank email to php-notes+get-146475@lists.php.net to get a copy of this message
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 ---- Server IP: 69.147.83.197 Probable Submitter: 41.251.19.120 ---- Manual Page -- http://www.php.net/manual/en/pdo.prepare.php Edit -- https://master.php.net/note/edit/86983 Del: integrated -- https://master.php.net/note/delete/86983/integrated Del: useless -- https://master.php.net/note/delete/86983/useless Del: bad code -- https://master.php.net/note/delete/86983/bad+code Del: spam -- https://master.php.net/note/delete/86983/spam Del: non-english -- https://master.php.net/note/delete/86983/non-english Del: in docs -- https://master.php.net/note/delete/86983/in+docs Del: other reasons-- https://master.php.net/note/delete/86983 Reject -- https://master.php.net/note/reject/86983 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#146475) next »