lmachite has asked for the wisdom of the Perl Monks concerning the following question:
I have the following code, which extracts information from a table:
$select = "select recno,name from TABLE;"; $result=$db->exec("$select"); my @row; while (@row = $result->fetchrow) { $recno = $row[0]; $name = $row[1]; }
Its working well, but it is extracting only the last record. My table has 10 records, and I need to use all of these later on my program. Some of you know how can I do that?
I tried to define a temporary scalar (ranging from 1 to 10) and create another scalar using the first one ($RECNO$TEMP, where $RECNO0 = $row[0], $RECNO1 = $row1, and so one), but didnt work. Apparently, I can not create scalar using another scalar in Perl. Am I correct?
I tried to create a composed array, but it can not be used in Perl.
Thanks for any information on this.
Marcelo
lmachite@dir.iai.int
lmachite@terra.com.br
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to preserve all instances from a database in an array?
by lima1 (Curate) on Mar 23, 2006 at 21:27 UTC | |
by davidrw (Prior) on Mar 23, 2006 at 23:05 UTC | |
|
Re: How to preserve all instances from a database in an array?
by ptum (Priest) on Mar 23, 2006 at 21:38 UTC | |
|
Re: How to preserve all instances from a database in an array?
by johngg (Canon) on Mar 23, 2006 at 23:22 UTC |