[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Multiple tables



The situation is that multiple Amazon product identifiers (ASIN) can be assigned to one of our products (parts).  We have a custom field ("asin") on the Add Part screen.  When data reaches ic.pl, the code (snippet) below is exercised to insert a row in the parts table.  Since there can be multiple ASINs, it would be better to store them in a separate table with a foreign key.

I'm an experienced Python developer, but a novice at Perl.  The last three lines of code are causing the queries to not work.  What syntax should I introduce into ic.pl to store ASINs in a separate database table?

Thanks.
Brian


    $sth = $dbh->prepare($query);
    $form->{partnumber} = trim($form->{partnumber});
    $form->{description} = trim($form->{description});

    <snip>

    $sth->execute(
        $form->{partnumber},      $form->{partname},

    <snip>

        $form->{expense_accno},   $form->{obsolete},
        $form->{image},           $form->{drawing},
        $form->{microfiche},      $partsgroup_id,
        $form->{id}
    ) || $form->dberror($query);

    $query = "insert into part_asin (part_id, asin) values (?, ?)";
    $sth = $dbh->prepare($query);
    $sth->execute( $form->{id}, 'B005QUQP8U');


Activus Technologies
Brian Wolf
Phone: 410.367.2958
Email: ..hidden..
  • Integrated Payment Solutions