title: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails
body: <p>I am trying to insert values into my comments table and I am getting a error. Its saying that I can not add or update child row and I have no idea what that means.
  My schema looks something like this:</p>
  
  <pre><code>--
  -- Baza danych: `koxu1996_test`
  --
  
  -- --------------------------------------------------------
  
  --
  -- Struktura tabeli dla tabeli `user`
  --
  
  CREATE TABLE IF NOT EXISTS `user` (
    `id` int(8) NOT NULL AUTO_INCREMENT,
    `username` varchar(32) COLLATE utf8_bin NOT NULL,
    `password` varchar(64) COLLATE utf8_bin NOT NULL,
    `password_real` char(32) COLLATE utf8_bin NOT NULL,
    `email` varchar(32) COLLATE utf8_bin NOT NULL,
    `code` char(8) COLLATE utf8_bin NOT NULL,
    `activated` enum('0','1') COLLATE utf8_bin NOT NULL DEFAULT '0',
    `activation_key` char(32) COLLATE utf8_bin NOT NULL,
    `reset_key` varchar(32) COLLATE utf8_bin NOT NULL,
    `name` varchar(32) COLLATE utf8_bin NOT NULL,
    `street` varchar(32) COLLATE utf8_bin NOT NULL,
    `house_number` varchar(32) COLLATE utf8_bin NOT NULL,
    `apartment_number` varchar(32) COLLATE utf8_bin NOT NULL,
    `city` varchar(32) COLLATE utf8_bin NOT NULL,
    `zip_code` varchar(32) COLLATE utf8_bin NOT NULL,
    `phone_number` varchar(16) COLLATE utf8_bin NOT NULL,
    `country` int(8) NOT NULL,
    `province` int(8) NOT NULL,
    `pesel` varchar(32) COLLATE utf8_bin NOT NULL,
    `register_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
    `authorised_time` datetime NOT NULL,
    `edit_time` datetime NOT NULL,
    `saldo` decimal(9,2) NOT NULL,
    `referer_id` int(8) NOT NULL,
    `level` int(8) NOT NULL,
    PRIMARY KEY (`id`),
    KEY `country` (`country`),
    KEY `province` (`province`),
    KEY `referer_id` (`referer_id`)
  ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=83 ;
  </code></pre>
  
  <p>and the mysql statement I am trying to do looks something like this:</p>
  
  <pre><code>INSERT INTO `user` (`password`, `code`, `activation_key`, `reset_key`, `register_time`,                `edit_time`, `saldo`, `referer_id`, `level`) VALUES (:yp0, :yp1, :yp2, :yp3, NOW(), NOW(), :yp4, :yp5, :yp6). Bound with :yp0='fa1269ea0d8c8723b5734305e48f7d46', :yp1='F154', :yp2='adc53c85bb2982e4b719470d3c247973', :yp3='', :yp4='0', :yp5=0, :yp6=1
  </code></pre>
  
  <p>the error I get looks like this:</p>
  
  <blockquote>
    <p>SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or
    update a child row: a foreign key constraint fails
    (<code>koxu1996_test</code>.<code>user</code>, CONSTRAINT <code>user_ibfk_1</code> FOREIGN KEY
    (<code>country</code>) REFERENCES <code>country_type</code> (<code>id</code>) ON DELETE NO ACTION ON
    UPDATE NO ACTION)</p>
  </blockquote>