in reply to How to interpolate sql-output
If you want this literal string of eight characters - $in{cid} - to be the value being tested in the where clause, you could do it like this:
On the other hand, if $in{cid} is an actual hash element in your script, and it happens to contain a string or number that you want to use as the value to be tested in the where clause, then:my $dbh = DBI->connect( $whatever… ) ... my $sth = $dbh->prepare( "select field from table where id != ?" ); $sth->execute( '$in{cid}' ); # an 8-character string is the placehold +er value ...
Did you have something in mind other than these two cases?my %in; $in{cid} = "something"; my $dbh = DBI->connect( $whatever… ) ... my $sth = $dbh->prepare( "select field from table where id != ?" ); $sth->execute( $in{cid} ); # the hash element value is the placeholde +r value ...
Sorry - I'll try to respond again, now that I understand the question.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to interpolate sql-output
by Seq (Novice) on Jan 14, 2015 at 03:36 UTC |