in reply to Re: SELECT COUNT and DBI: rows
in thread SELECT COUNT and DBI: rows

You can't use the rows method on select statements, only on statements that modify the database.

OK, now I'm really confused. I do that all the time! I do a select, and use rows to check if it returned anything. Don't I? (Goes to check...) yes I do. I have code like this:

## prepare some SELECT statement $sth->execute() || die "Error: " . $dbh->errstr; if( $sth->rows > 0 ){ ## do some stuff }


($_='kkvvttuubbooppuuiiffssqqffssmmiibbddllffss') =~y~b-v~a-z~s; print

Replies are listed 'Best First'.
Re: Re: Re: SELECT COUNT and DBI: rows
by dws (Chancellor) on Sep 29, 2003 at 00:07 UTC
    OK, now I'm really confused. I do that all the time!

    It might work on whatever database you're using, but getting a row count back from a SELECT isn't portable.

      I'm using DBI and MySQL. That's interesting to know. I guess I should keep reading this thread to see what the more portable way to do it is...



      ($_='kkvvttuubbooppuuiiffssqqffssmmiibbddllffss') =~y~b-v~a-z~s; print