in reply to Error adding a record into a MySQL table: 'Unknown column ...'

Building on what other monks have already stated, here is a pattern for you to use that might help with what you are trying to accomplish. I'm making a few assumptions here, but here goes:

my $queryObj = $db_handle->prepare( qq( insert into employee(id,first_name,last_name, address.line.2,address.line.3) values (?,?,?,?,?,?) ) ) or die "Could not prepare query: ".$db_handle->errstr;
Assuming you don't die due to syntax error, bad column names or other problems your next step somewhere in code would be
$queryObj->execute( ...insert value list here ... ) or die "Could not execute " . $queryObj->errstr;

As merlyn pointed out, beware of SQL injection attacks. Before I pass data from a CGI form I'm going to do some cursory validation at the very least if not stringent validation to make sure I'm getting back in my CGI input what I expected and not bad stuff.

Also, using placeholders and/or variable binding makes use of some of the strengths of using DBI in the first place. Otherwise it isn't worth the overhead.


Peter L. Berghold -- Unix Professional
Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg