Here's an example:
-
#! /usr/bin/perl
use Mysql;
$dbh = Mysql->connect("localhost", "verycooldatabase", "", "");
$query = "select this from that";
$sth = $dbh->query($query);
// returns one row at the time in array @arr
while(@arr = $sth->fetchrow) {
foreach $data (@arr)
print(
How do I query a database with Perl - retrieve a item and then have that
as a var to use in another insert statement
Currently I have :
Use DBI
I define: my vars : host,db,username,password etc
I create my db object etc
I used the script to do a insert to my db and it worked fine - but I
can