#36281 [Fbk->Opn]: bindParam not working with LIKE '%:foo%'
| From: | vendor at visv dot net | Date: | Sat, 04 Feb 2006 17:21:17 +0000 |
| Subject: | #36281 [Fbk->Opn]: bindParam not working with LIKE '%:foo%' | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-92905@lists.php.net to get a copy of this message | ||
ID: 36281
User updated by: vendor at visv dot net
Reported By: vendor at visv dot net
-Status: Feedback
+Status: Open
Bug Type: PDO related
Operating System: Linux
PHP Version: 5.1.2
New Comment:
No change nor improvement with
http://snaps.php.net/php5.1-latest.tar.gz on
Feb 4. 12:20PM
Previous Comments:
------------------------------------------------------------------------
[2006-02-04 12:48:08] tony2001@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5.1-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5.1-win32-latest.zip
------------------------------------------------------------------------
[2006-02-04 05:35:05] vendor at visv dot net
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 this bug report at http://bugs.php.net/?id=36281&edit=1