in reply to dbi insert
my $dbh = DBI->connect("um","","","mysql") ||
die "Could not connect: $DBI::errstr\n";
This should be:</>
my $dbh = DBI->connect("DBI:mysql:$host", $user, $pass) || die "Could not connect: $DBI::errstr\n";
Your SQL statement needs to be a quoted string:
my $sth = $dbh->prepare("INSERT into people (fornavn, efternavn, cpr, adresse, zip, city, tjenestested) values ($fornavn, $efternavn, $cpr, $adresse, $zip, $city, $tjenestested"));
And I'm willing to bet that some of those column values should be quoted - but not knowing your schema, I can't tell which ones.
Also, you should check the return code from all of your functions:
--my $sth = $dbh->prepare("INSERT into people (fornavn, efternavn, cpr, adresse, zip, city, tjenestested) values ($fornavn, $efternavn, $cpr, $adresse, $zip, $city, $tjenestested")) || die $dbh->errstr; $sth->execute || die $dbh->errstr; $sth->finish || die $dbh->errstr;
"The first rule of Perl club is you don't talk about Perl club."
|
|---|