inncoggnitto
Programmer
i am pulling data from a db and need to push into a 2d array a column at a time. will loop through the following up to three time (so $k will be from 0 to 2). the sql statement will pull one set of data at a time out and there can be up to three recordsets in the results. i need to get the data into the array to put into html table later on. i am getting the following error. "can't use subscript on array slice near q]. the following is what i thought would work. only occasional perl programmer (sorta) so be kind.
thanks
thanks
Code:
$sth = $dbh->prepare("SELECT * from PSTCOMP WHERE PSTCOMP.FACID = '$requested_fac_id' AND PSTCOMP.UNIT_ID = '$unit_id' ORDER BY PSTCOMP.TANK_ID, PSTCOMP.COMPART_LETTER");
$sth->execute();
while ($fields = $sth->fetchrow_arrayref()) {
push @comp, [@$fields]; .
$rowcount_comp++;
}
#this is where i am trying to read the one dim array into a 2 dim where $k is the column number
for ($q=0; $q=$#comp; $q++){
@comp_ary[$k][$q] = $comp[$q];
}