Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
It runs a lot slower than it should, and I'm not sure why. Also, if there are multiple columns in my database, I don't know how to associate the columns with each other. Right now I can only pull up data from one column (the script is getting data from the first 2 columns, ignoring the first, and only saving what's in the second. That's intentional because I had no other idea how to do this). Any ideas on this?#!/usr/bin/perl -w use CGI qw(:standard); use DBI; use strict; my @list = ''; print header; print start_html; my $dbh = DBI->connect('DBI:mysql:test') or die "Trouble opening datab +ase: $DBI::errstr; stopped"; my $sth = $dbh->prepare("SELECT name, data, ID FROM frog WHERE ID like + '%'") or die "Trouble preparing statement: $DBI::errstr; stopped"; $sth->execute() or die "Trouble executing statement: $DBI::errstr; sto +pped"; while ( my ($blankfield, $data) = $sth->fetchrow_array() ) { push @list, $data; } my $i = $#list; while ($i >= ($#list - 2)) { print $list[$i--], "<BR>\n"; } $dbh->disconnect(); print end_html;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Database, DBI Slowness
by btrott (Parson) on Nov 11, 2000 at 05:03 UTC |