my $sql1 = "SELECT id, name_short, name_long FROM states WHERE name_short='PA";
$sth1 = $dbh->prepare($sql1);
#
$sth1->execute();
It works. But when I do:
$StateProvince = 'PA';
my $sql1 = "SELECT id, name_short, name_long FROM states WHERE name_short=$StateProvince";
$sth1 = $dbh->prepare($sql1);
#
$sth1->execute();
I get a message that:
DBD::mysql::st execute failed: Unknown column 'PA' in 'where clause' at TestDBI.pl line 14.
It seems to me this should work. I am new at this so I must have done something wrong, but what?
Thanks for any help you can offer.
Bob Rawlinson