Hello, I can think of two ways to do what you want: 1. use fetchrow_arrayref and get the output by its index. while ( my $row = $sth->fetchrow_arrayref ) { $Msgs_In=$row->[2]; $Msgs_Out=$row->[3]; $Bytes_In=$row->[0]; $Bytes_Out=$row->[1]; } 2. use the SQL "AS" modifier: SELECT sum(bytes_in) as s_bytes_in, sum(bytes_out) as s_bytes_out, sum(msgs_in) as s_msgs_in, sum(msgs_out) as s_msgs_out FROM trafficperhour WHERE time >= $BeginHour and time < $EndDay;
and then, you can access the values by their aliases s_*. Hope this helps,,, Aziz,,, On Sun, 23 Dec 2001 18:39:23 +0300, [EMAIL PROTECTED] wrote: > hi all, > i am trying to access the results of a query made to a mysql db. > the query is > ====================query code========================== my $incoming = > "SELECT sum(bytes_in),sum(bytes_out),sum(msgs_in)," > ."sum(msgs_out)" > ." from trafficperhour WHERE time >= $BeginHour > and time" ." < $EndDay;"; > ========================================================= then i tried > to access the results with the following code but realized the query was > returning something like sum(msgs_in) sum(msgs_out) etc. > ========================================================== > while ( my $row = $sth->fetchrow_hashref ) > { > $Msgs_In=$row->{msgs_in}; > $Msgs_Out=$row->{msgs_out}; > $Bytes_In=$row->{bytes_in}; > $Bytes_Out=$row->{bytes_out}; > } > ============================================================ and > therefore $Msgs_In, $Msgs_Out ... are empty. can someone tell me where i > can find info on how to access the results of my query? thanks -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]