F
Faith Greenwood
Hi,
Seems like I've been googling for hours and can't find the solution.
Maybe someone here can help:
I have 3 arrays, each with 3 items:
@array1=(1,2,3); #names
@array2=(4,5,6); #email addresses
@array3=(7,8,9); #cities
I need to put the values of each into a database, in order. This is
the idea I have so far, which is obviously wrong:
foreach (@array1){
my $sql = "INSERT INTO example (names,email,city) VALUES (?,?,?)";
my $sth = $dbh->prepare($sql);
$sth->execute($array1,$array2,$array3);
}
In other words I want to put the array items in the 'example' table so
that I have the following 3 records in my database:
####Record 1
name: 1, email: 4, city: 7;
####Record 2
name: 2, email: 5, city: 8;
####Record 3
name: 3, email: 6, city: 9;
How would I do that?
Seems like I've been googling for hours and can't find the solution.
Maybe someone here can help:
I have 3 arrays, each with 3 items:
@array1=(1,2,3); #names
@array2=(4,5,6); #email addresses
@array3=(7,8,9); #cities
I need to put the values of each into a database, in order. This is
the idea I have so far, which is obviously wrong:
foreach (@array1){
my $sql = "INSERT INTO example (names,email,city) VALUES (?,?,?)";
my $sth = $dbh->prepare($sql);
$sth->execute($array1,$array2,$array3);
}
In other words I want to put the array items in the 'example' table so
that I have the following 3 records in my database:
####Record 1
name: 1, email: 4, city: 7;
####Record 2
name: 2, email: 5, city: 8;
####Record 3
name: 3, email: 6, city: 9;
How would I do that?