I have two tables related to categories. One is called category_list which is mainly for administration purpose:
Code MySQL:
CREATE TABLE IF NOT EXISTS `category_list` (
  `category_id` tinyint(2) NOT NULL auto_increment,
  `category` varchar(32) default NULL,
  PRIMARY KEY  (`category_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8;
and a table categories, holding the different categories in 6 different languages:
Code MySQL:
CREATE TABLE IF NOT EXISTS `categories` (
  `cat_id` tinyint(2) NOT NULL auto_increment,
  `category_id` tinyint(2) NOT NULL,
  `language_abbr` char(3) NOT NULL,
  `category_name` varchar(32) NOT NULL,
  PRIMARY KEY  (`cat_id`),
  FOREIGN KEY (`category_id`) REFERENCES `category_list` (`category_id`) ON DELETE CASCADE,
  FOREIGN KEY (`language_abbr`) REFERENCES `languages` (`language_abbr`) ON DELETE CASCADE,
  KEY `category_name` (`category_name`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8;
So doing an insert goes in two steps. The first insert in to the table category_list and after that into the table categories, but I can't figure out how to get the six different values for the six text fields(languages) in the database since they have a different name in the form, where in the database there is just one field (category_name). Everything goes well with the category_id and language_abbr by using the id from the first insert and using the table languages to get the active languages:
Code MySQL:
  INSERT INTO
        categories
        (
          category_id
        , language_abbr
 
        )
  SELECT
          #catID#
        , language_abbr
 
  FROM
          languages
  WHERE
        language_isActive IN ( 1 )
Unfortunately a can't give those textfields the same name like with a check box group. Any ideas?