## chunk 'O' code $sql = "SELECT COUNT(*) "; $sql .= "FROM sc_products "; $sql .= "WHERE name LIKE '%$search_name%' "; $sql .= "AND keywords LIKE '%Color%'"; $sth = $dbh->prepare($sql); $sth->execute || $error->LogError("Error opening database connection for product count in search.cgi".$dbh->errstr, 0); # get my count my $count = $sth->fetchrow_array; $sth->finish; $sql = "SELECT name, image2 "; $sql .= "FROM sc_products "; $sql .= "WHERE name LIKE '%$search_name%' "; $sql .= "AND keywords LIKE '%Color%'"; $sth = $dbh->prepare($sql); $sth->execute || $error->LogError("Error opening database connection for product count in search.cgi".$dbh->errstr, 0); while(my @results = $sth->fetchrow_array) { ## Use my count in here for some cool table formatting... print "... } $sth->finish; $dbh->disconnect();