$sql = "SELECT COUNT(*) FROM theTable WHERE column = $value"; $iterations = 1000; $sth = $dbh->prepare($sql) or die("Could not prepare!" . $dbh->errstr); $exec_time = timethis($iterations, ' $sth->execute() or die("Could not execute!" . $dbh->errstr); $count = $sth->fetchrow_array( ); ');