title: Insertion Failed:Cannot add or update a child row: a foreign key constraint fails
body: <p>I have two tables- users and language with a foreign key link of their primary key 'id'.
  I have checked that the type is innoDB for the tables. I have delete- restrict and update -cascade.</p>
  
  <p>This insert query, inserts it into the language table: (it can be more than one row which is added as the form has dynamic clickevent button)</p>
  
  <pre><code>if(empty($_SESSION['user_id'])) { // user not logged in; redirect to somewhere else }
  
  $sql_insert = "INSERT into `language`
   (`native`,`other`,`other_list`,`other_read`, `other_spokint`
   ,`other_spokprod`,`other_writ`  )
  VALUES
   ('$native','$other','$other_list','$other_read','$other_spokint','$other_spokprod',
   '$other_writ') ";
  
  mysql_query($sql_insert,$link) or die("Insertion Failed:" . mysql_error());     
  }
  </code></pre>
  
  <p>This is the full error:</p>
  
  <pre><code>Insertion Failed:Cannot add or update a child row: a foreign key constraint fails
  (`members`.`language`, CONSTRAINT `language_ibfk_1` FOREIGN KEY (`id`) 
  REFERENCES `users` (`id`))
  </code></pre>
  
  <p>Any help would be appreciated!</p>
  
  <p>Table structure for table language:</p>
  
  <pre><code>CREATE TABLE IF NOT EXISTS `language` (
   `id` bigint(20) NOT NULL AUTO_INCREMENT,
   `native` varchar(30) NOT NULL,
   `other` varchar(30) NOT NULL,
   `other_list` varchar(9) NOT NULL,
   `other_read` varchar(9) NOT NULL,
   `other_spokint` varchar(9) NOT NULL,
   `other_spokprod` varchar(9) NOT NULL,
   `other_writ` varchar(9) NOT NULL,
    PRIMARY KEY (`id`)
    ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
  
  
  RELATIONS FOR TABLE `language`:
  `id`
  `users` -&gt; `id`
  </code></pre>