$stmt = "insert into users (user_id,username,password,pin,position,forename,lastname,business,address1,address2,city,state,zip, email, phone_home, phone_cell, MJ, MD, DD, DP, comments) values ((SELECT AUTO_INCREMENT FROMinformation_schema.TABLES WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME='users'),CONCAT('bwm', (SELECT AUTO_INCREMENT FROM information_schema.TABLES WHERE TABLE_SCHEMA=DATABASE()ANDTABLE_NAME='users')), ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
####
my $sth = $dbh->prepare ($stmt) or die "Error Preparing:\n" . $stmt . "\nDBI returned: \n", $dbh->errstr;
$value = $sth->execute ($password, $pin, $position, $forename, $lastname, $business, $address1, $address2, $city, $state, $zip, $email, $phone_home, $phone_cell, $MJ, $MD, $DD, $DP, $comments) or die "Unable to execute query: " . $sth->errstr;
my $new_id = $sth->{'mysql_insertid'};
####
=for comment
insert into users (user_id, username,password,pin,position, forename,lastname,business, address1, address2,city,state,zip, email ,phone_home, phone_cell,MJ,MD,DD,DP, comments) values ( (SELECT AUTO_INCREMENT FROM information_schema.TABLES WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME='users'), CONCAT('bwm', (SELECT AUTO_INCREMENT FROM information_schema.TABLES WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME='users')), 'vmmv', 'BbwmB','3', 'Lucifer','Jackson','BWMLLC', '1610 W Udall St','Apt 1', 'Jasonville','UT','87167','dingy@yahoo.com','(203) 418-5467','(203) 245-4567','2017-01-31','120.00', '2018-03-21','2019-03-20','Blah Blah')
=cut