#36281 [NEW]: bindParam not working with LIKE '%:foo%'
From: vendor at visv dot net
Operating system: Linux
PHP version: 5.1.2
PHP Bug Type: PDO related
Bug description: bindParam not working with LIKE '%:foo%'
Description:
------------
$q = "SELECT id, name FROM test WHERE name like '%:foo%';
$s = "carrot";
$dbh = new PDO('mysql:...', $user, $pass);
$sth = $dbh->prepare($q);
$sth->bindParam(':foo', $s);
$sth->execute()
while ($r = $sth->fetch()) {
print_r($r);
}
the above does not work. Adding PDO::PARAM_STR, and the
length argument do not help matters.
simply embedding $s in place of :foo does work. It also
works fine if I leave off the "'%" and "%'" parts
and $s == the column value. It just seems bindParam()
cannot cope with the '% %' parts in the query.
I do not find similar in your bugtracking system, nor
in user supplied notes (currently there are none).
Thanks.
Reproduce code:
---------------
See description.
--
Edit bug report at http://bugs.php.net/?id=36281&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=36281&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=36281&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=36281&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=36281&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=36281&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=36281&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=36281&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=36281&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=36281&r=support
Expected behavior: http://bugs.php.net/fix.php?id=36281&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=36281&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=36281&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=36281&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=36281&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=36281&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=36281&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=36281&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=36281&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=36281&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=36281&r=mysqlcfg
Thread (7 messages)
- vendor at visv dot net