Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2009
    Location
    philadelphia
    Posts
    2

    Unanswered: 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>;
    }
    }
    }
    }

    ------------------------------------------

  2. #2
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •