This is working:
$sqlstatement="SELECT Table1.Name, Table1.Address, Table1.City,
Table1.State, Table1.ZIP, Table1.Phone
FROM Table1 WHERE Table1.BusType = 'ARCHITECTS'";
$sth = $dbh->prepare($sqlstatement);
But attempting on the fly, this is not:
my @lines = <DATA>;
my $line;
foreach $line ( @lines ) {
#prepare and execute SQL statement
$sqlstatement="SELECT Table1.Name, Table1.Address, Table1.City,
Table1.State, Table1.ZIP, Table1.Phone
FROM Table1 WHERE Table1.BusType = '$line';
$sth = $dbh->prepare($sqlstatement);
I've tried variations with the quotes but I'm stuck.