CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: DBI:
value not passed to query

 



hakchop
New User

Feb 17, 2009, 7:24 AM

Post #1 of 2 (2825 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...



Code
 
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>;
}
}
}



FishMonger
Veteran / Moderator

Feb 17, 2009, 8:02 AM

Post #2 of 2 (2822 views)
Re: [hakchop] value not passed to query [In reply to] Can't Post

What makes you think the value isn't being passed to the query?

What errors and/or warnings are you receiving?

Why do you have <STDIN> in the while loop? That's probably why you're not getting the results you expect.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives