Hi, there: I try to write a perl code that takes form data from html page and inserts or updates database tables. I have successfully insert data into one table, but fail to insert data into another table. My sample as follows: *************************************************** my $dbh = DBI->connect('dbi:mysql:ordering','yxc', '9cvpt') ||die "unable to connect: $DBI::errstr";
my $sql = "INSERT INTO order_record (reqID, product_name,catalog_No,supplier,order_date,status,who_ordered,PO_Num,local_req_No, item_type, description, unit_price, unit_size, num_of_unit, measure_type) VALUES ('','$product_name','$catalog_no','$supplier','$order_date', '$status','$username','$PO_Num','$local_Req_No','$item_type','$req_note','$unit_price','$unit_size','$no_of_unit','$meas_type')"; my $sth = $dbh->prepare($sql) ||die "unable to prepare $sql: $DBI::errstr"; $sth->execute(); $sth->finish(); $dbh->disconnect(); my $dbh2 = DBI->connect('dbi:mysql:ordering','yxc', '9cvpt') ||die "unable to connect: $DBI::errstr"; my $sql2 = "INSERT INTO company-profile (company_name, contact_name,address,city,postal_code,phone,fax,e-mail,website) VALUES ('$supplier','','$address','','','$tel_num','$fax_num','$email','')"; my $sth2 = $dbh->prepare($sql2) ||die "unable to prepare $sql: $DBI::errstr"; $sth2->execute(); $sth2->finish(); $dbh2->disconnect(); ****************************************************** I have tried to use one connection to execute two sql statement, it didn't work also. So, I seperated two process, it still doesn't work. Anyone has the idea. Thanks yc __________________________________________________ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]