use warnings; use DBI; use DBD::mysql; use CGI qw( :standard ); use CGI::Carp "fatalsToBrowser"; print header, start_html('SQL Must Work!'); # Great title ;) my $dbh = DBI->connect("DBI:mysql:data:server","uname","pass") or die( "Could not make connection to database: $DBI::errstr" ); # Slightly altering this my $sth = $dbh->prepare("SELECT Tab1, Tab2, Tab3 FROM UData"); $sth->execute; # Using $sth, instead of $dbh while (my @row = $sth->fetchrow_array ) { my ( $item0, $item1, $item2 ) = @row; if ($item0 >= $somevalue) { print br, "$item0"; } } warn( $DBI::errstr ) if ( $DBI::err ); $dbh->disconnect(); print '