title: MySQL insert multiple values when I have foreign key
body: <p>I have stuck many hours and i'd like your help.</p>
  
  <p>I have two arrays:</p>
  
  <pre><code>CREATE TABLE if not exists chr(
  id_chr int(10) NOT NULL AUTO_INCREMENT,
  number int(10),
  genename varchar(30) not null,
  ensembleid varchar(30) not null,
  strand int(10) not null,
  band varchar(10) not null, 
  genestart int(30) not null,
  geneend int(30) not null,
  biotype varchar(30),
  status varchar(10),
  transcriptsnum int(10),
  gc float(10) not null,
  PRIMARY KEY(id_chr)
  );
  </code></pre>
  
  <p>and </p>
  
  <pre><code>CREATE TABLE if not exists gene(
  id_gene int(10) NOT NULL AUTO_INCREMENT,
  name varchar(30) not null,
  transcriptid int(30) not null,
  idchr int(10) not null,
  PRIMARY KEY(id_gene)
  );
  </code></pre>
  
  <p>So far I have inserted values to chr table (8000 lines approximately) and I want a multiple insert for table gene as well.</p>
  
  <p>I get the error: </p>
  
  <pre><code>Error: Cannot add or update a child row: a foreign key constraint fails
  </code></pre>
  
  <p>The question is, how can I insert the values for the <code>foreign key</code> due to the fact I have to insert multiple rows?</p>