
hakchop
New User
Feb 17, 2009, 7:24 AM
Post #1 of 2
(5066 views)
|
value not passed to query
|
Can't Post
|
|
Hi guys, I am trying to run a query which takes a value in the where clause and returns the 2 fields as result. Select * from table where sid=? My values are being read from a hash and i pass it using the bind_param, but seems like the value isnt being passed to the query. Can anybody tell me where i am going wrong...
my $select_dbh = DBI->connect("DBI:mysql:$db_chip;host=$host",$user, $password) or die "Can't connect to MySQL database: $DBI::\ errstr\n"; my $select_sql = qq{ SELECT sampleid, chipid FROM new_pedpath where sampleid=?}; my $select_sth = $select_dbh->prepare($select_sql); my @vals=(); my($subid, $chp); foreach my $sid(sort keys %pft_list) { if($pft_list{$sid} eq "no"){ eval { $select_sth->bind_param( 1, $sid, SQL_VARCHAR); $select_sth->execute(); while(@vals=$select_sth->fetch()){ print "@vals\n";<STDIN>; } } }
|