I am trying to use a select statement from a MySQL DB using perl - I need to place the retreived data into an array - IE @db_data.
Here is the code that I am currently using:
my $dsn = "DBI:mysqlPP:nn_work_orders:$DB::SERVER";
my $dbh = DBI->connect($dsn, $DB::USER, $DB:ASS);
my $sth = $dbh->prepare(qq{ SELECT * FROM wo_open WHERE wo_id = '$SELECTOR' });
$sth->execute();
($DB::01, $DB::02, $DB::03, $DB::04) = $sth->fetchrow_array();
$sth->finish();
$dbh->disconnect();
This works great but then to add this to an array - I would have to do something like @db_data = ($DB::01, $db::02...) Is there a way to do this WITHOUT having to add the extra statement - rather doing it in the above? Also, wo_id is a key and unique.
Thanks in advance!
- Scott
Wise men ask questions, only fools keep quite.
Here is the code that I am currently using:
my $dsn = "DBI:mysqlPP:nn_work_orders:$DB::SERVER";
my $dbh = DBI->connect($dsn, $DB::USER, $DB:ASS);
my $sth = $dbh->prepare(qq{ SELECT * FROM wo_open WHERE wo_id = '$SELECTOR' });
$sth->execute();
($DB::01, $DB::02, $DB::03, $DB::04) = $sth->fetchrow_array();
$sth->finish();
$dbh->disconnect();
This works great but then to add this to an array - I would have to do something like @db_data = ($DB::01, $db::02...) Is there a way to do this WITHOUT having to add the extra statement - rather doing it in the above? Also, wo_id is a key and unique.
Thanks in advance!
- Scott
Wise men ask questions, only fools keep quite.