[PLUG] Perl DBI question

AthlonRob AthlonRob at axpr.net
Tue Feb 15 01:05:50 UTC 2005


On Sun, 2005-02-13 at 17:50 -0700, Matt Alexander wrote:
> Any suggestions?

Yes, build your query as a string and then execute it.  :-)

$sql  = "SELECT * FROM table WHERE coll LIKE\'\%";
$sql .= $value . "\%\'";
$sth = $dbh->prepare($sql);
$sth->execute();

Just a matter of style, I think, but I prefer building SQL queries as
strings before executing them rather than using the "?" stuff.  IMHO, it
is simpler and easier to deal with and debug.

-- 
Rob                    |  If not safe,
  http://rob.axpr.net  |    one can never be free.




More information about the PLUG mailing list