#!/usr/bin/perl use strict; use warnings; use DBI; use GD::Graph::Data; use GD::Graph::bars; # do DBI things, like connecting to the database, statement # preparation and execution # Don't forget to print the results of your various DBI commands. # Your open(), for example, might not be working correctly. my $sql = "SELECT time, mastuntemp, LineTemp, spargtemp FROM brew_temp_tb WHERE sitename = 'Brew' AND batchnumber = '$batchnumber' ORDER BY time"; print "DEBUG: \$sql = \"$sql\"\n"; my $data = GD::Graph::Data->new(); print "DEBUG: \$data = \"$data\"\n"; my $sth = $dbh->prepare($sql); print "DEBUG: \$sth = \"$sth\"\n"; if (!$sth->execute()) { die "Error: ". $sth->errstr ."\n"; } my @row; while (@row = $sth->fetchrow_array) { print "DEBUG: \@row = \"@row\"\n"; my $rowidx = 0; foreach my $rowdata (@row) { print " [$rowidx] = \"$rowdata\"\n"; $rowidx++; } $data->add_point(@row); } exit;