hey!

I have some query with a LIKE expression e.g. "SELECT * FROM table WHERE column LIKE "$phpvar%", but I would like to use prepared statements instead of writing the variable directly into the query. So I write:

$sth = $this->conn->prepare ("SELECT * FROM table WHERE column LIKE \":phpvar%\"");
$sth->bindParam (":phpvar", $phpvar);
$sth->execute();
var_dump ($sth->fetchAll());

Here I get an empty result set when using prepared statements. However when just using string concatenation and putting the variable directly into the query it works fine.

Is this expected or a bug?

Cheers,
Jakob

--
Sun Certified Programmer for the Java 2 Platform, Standard Edition 5.0
_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php

Reply via email to