If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Perl and the DBI > problem fetching rows

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-16-09, 15:11
hakchop hakchop is offline
Registered User
 
Join Date: Feb 2009
Location: philadelphia
Posts: 2
problem fetching rows

Hi guys,

I am trying to execute a query which takes one input value and returns 2 columns in the result.

Not sure where i am making the mistake, cos it is not returning any result. I think i am a little confused with the passing the value to the query and then reading the result.

Any help will be greatly appreciated.

Thank you

#--------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_INTEGER);
$select_sth->execute();
#$select_sth->bind_columns(\$subid, $chp);
while(@vals=$select_sth->fetch()){
print "@vals\n";<STDIN>;
}
}
}
}

------------------------------------------
Reply With Quote
  #2 (permalink)  
Old 02-17-09, 10:56
hakchop hakchop is offline
Registered User
 
Join Date: Feb 2009
Location: philadelphia
Posts: 2
forgot to add

The problem with the code is that it is not passing the value to the where clause.
I am wondering if the bind_param isnt the way to pass the value to the query.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On