Help for this page

Select Code to Download


  1. or download this
           "rows"
                 $rv = $sth->rows;
    ...
               One alternative method to get a row count for a "SELECT" is
    + to exe-
               cute a "SELECT COUNT(*) FROM ..." SQL statement with the sa
    +me "..."
               as your query and then fetch the row count from that.
    
  2. or download this
      my $sql = {
         SELECT count(*)
    ...
      my $sth = $dbh->prepare($sql);
      $sth->execute($name);
      my ($count_rows) = $sth->fetchrow_array();
    
  3. or download this
      my $sql = {
         SELECT name
    ...
         ### do something with $name here ###
         $count_rows += 1;
      }