note 86982 added to pdo.prepare
| From: | said_rf at hotmail dot com | Date: | Thu, 13 Nov 2008 11:56:04 +0000 |
| Subject: | note 86982 added to pdo.prepare | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-146472@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:
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/86982
Del: integrated -- https://master.php.net/note/delete/86982/integrated
Del: useless -- https://master.php.net/note/delete/86982/useless
Del: bad code -- https://master.php.net/note/delete/86982/bad+code
Del: spam -- https://master.php.net/note/delete/86982/spam
Del: non-english -- https://master.php.net/note/delete/86982/non-english
Del: in docs -- https://master.php.net/note/delete/86982/in+docs
Del: other reasons-- https://master.php.net/note/delete/86982
Reject -- https://master.php.net/note/reject/86982
Search -- https://master.php.net/manage/user-notes.php