JackTheRussel
Programmer
Hi.
I have tiny problem.
I use 2 different sql-queries in my program.
Example
And if run this query (setup==1) in mysql-promt I get this kind results
Now I wonder how I get each values into own tables.
I would like put records into tables like this:
Now when I do like this:
It puts results into table like this:
Could someone help me.
I have tiny problem.
I use 2 different sql-queries in my program.
Example
Code:
If ($setup == 1){
$sql ="SELECT MIN(value), MAX(value), AVG(value) from ... LIMIT 5;
Code:
elsif (setup==0){
$sql="SELECT quota, numbers, MIN(value), MAX(value), AVG(value) from ... LIMIT 5;
And if run this query (setup==1) in mysql-promt I get this kind results
Code:
MIN MAX AVG
5 9 7
4 4 4
10 2 6
3 7 5
5 5 5
Now I wonder how I get each values into own tables.
I would like put records into tables like this:
Code:
@MINtable[5, 4, 10, 3, 5]
@MAXtable[9, 4, 2, 7, 5]
@AVGtable[7, 4, 6, 5, 5]
Code:
my @table;
my $sth = $db_connection->prepare ($sql);
$sth->execute ();
while (my @foo = $sth->fetchrow_array ())
{
push (our @table, @foo );
}
It puts results into table like this:
Code:
$table[0] = 5
$table[1] = 9
$table[2] = 7
etc...