LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Perl Sqlite DBI $sth->rows (https://www.linuxquestions.org/questions/programming-9/perl-sqlite-dbi-%24sth-rows-106992/)

The Jesus 10-21-2003 11:35 PM

Perl Sqlite DBI $sth->rows
 
I am trying to run a query on a sqlite database in Perl. After I am through with the query I would like to check the rows. The problem I am having is that $query_handle->rows always returns -1

my $query_handle = $dbh->prepare('SELECT name FROM patient_data WHERE name = ?')
or die "Couldn't prepare statement: " . $dbh->errstr;


if ($query_handle->rows == 0) {
#DO Something
}

What am I doing wrong??? - I am assuming that if the query does not find a name $query_handle->rows would equal 0? I get -1.

Thanks in advance.


:confused:


All times are GMT -5. The time now is 10:18 PM.