in reply to Right Number DB

If your database supports rows(), and you aren't interested in portability to other databases, you may find that useful.

my $count = $sth->rows(); if ($count > 1) { # display count } elsif ($count == 1) { # single record stuff } else { # nothing found }

Replies are listed 'Best First'.
Re: Re: Right Number DB
by hardburn (Abbot) on Dec 10, 2003 at 21:27 UTC

    Careful, though. rows() is only guarenteed to work if you've already fetched all the rows returned. Though you can get away with it on MySQL and maybe some other DBMSes.

    ----
    I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
    -- Schemer

    : () { :|:& };:

    Note: All code is untested, unless otherwise stated