use DBI; # do DBI things, like connecting to the database, statement # preparation and execution use GD::Graph::Data; use GD::Graph::bars; my $data = GD::Graph::Data->new(); while (@row = $sth->fetchrow_array) { $data->add_point(@row); } my $chart = GD::Graph::bars->new(); my $gd = $chart->plot($data); #### use GD::Graph::Data; use GD::Graph::bars; my $data = GD::Graph::Data->new(); my $sth = $dbh->prepare("SELECT time, mastuntemp, LineTemp, spargtemp FROM brew_temp_tb WHERE sitename = 'Brew' AND batchnumber = '$batchnumber' ORDER BY time";"); if (!$sth->execute()) { die "Error: ". $sth->errstr ."\n"; } my @row; while (@row = $sth->fetchrow_array) { $data->add_point(@row); }