Honkey_Magoo 0 Newbie Poster

I have created the code to connect to a MySQL database and retrieve the values of a table. This is the function for printing the table:

# Name:         dbHistory
# Purpose:      prints srvHistory table from database
# Parameters:   N/A
# Returns:      N/A
# This is the implementation of the function

sub dbHistory{
my $connect = dbConnect();	# Creates connection 
my $query = "SELECT * FROM srvHistory";
my $query_h = $connect->prepare("$query") or die "Unable to prepare insert query. $DBI::errstr"; # Preps query
$query_h->execute() or die "Unable to execute query. $DBI::errstr";	# Executes query

my $sysID;
my $timeStamp;
my $upTime;
my $highestPartition;
my $hdPercent;
my $tx;
my $rx;
my $memPercent;
my $cpuPercent;
my $temp;
my $misc;

 	while (($sysID, $timeStamp, $upTime, $highestPartition, $hdPercent, $tx, $rx, $memPercent) = $query_h->fetchrow()) 
	{
		$Response->Write( "$sysID, $timeStamp, $upTime, $highestPartition, $hdPercent, $tx, $rx, $memPercent<br>");
		
	}
$connect->disconnect() or die "Unable to disconnect. $DBI::errstr";	# Disconnect from MySQL

}

I would like to output the values into an HTML table or any sort of table that can organize this. Also if i could somehow save the values into a hash and then use the hash to display the values that would nice (but i am not to sure on how to do that). This is my current output:

230 1249905600 5565940 sample 50 10200 15000 40 20 35 4
580 1255593600 11030208 sample 50 10000 10000 50 50 25 1

I would like to state that i am not to familiar with PERL or ASP. Most of the code was provided and modified to suit my purpose.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.