title: Error 1452: 23000 Cannot add or update a child row... mysql
body: <p>My code is:</p>
  
  <pre><code> CREATE DATABASE IF NOT EXISTS courses;
  
   USE 'courses'
  
   CREATE TABLE IF NOT EXISTS teachers(
        id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
        name VARCHAR(50) NOT NULL COMMENT 'name',
        addr VARCHAR(255) NOT NULL COMMENT 'addr',
        phone INT(20) NOT NULL ,
        CONSTRAINT pkTeachers PRIMARY KEY (id) )ENGINE=InnoDB DEFAULT CHARSET=utf8;
  
   CREATE TABLE IF NOT EXISTS courses(
         id INT AUTO_INCREMENT NOT NULL,
         title VARCHAR(200) NOT NULL COMMENT 'title',
         length INT NOT NULL COMMENT 'length',
         cathegory INT NOT NULL COMMENT 'cathegory',
         description TEXT DEFAULT '' COMMENT 'description',
         previous INT NOT NULL COMMENT 'previous',
         CONSTRAINT pkCourses PRIMARY KEY (id),
         INDEX ixCathegory (cathegory),
         INDEX ixprevious (previous),
         CONSTRAINT fkPrevious FOREIGN KEY (previous) REFERENCES courses (id) )ENGINE=InnoDB DEFAULT CHARSET=utf8;
  </code></pre>
  
  <p>When I want insert data to 'course' table I have an error: </p>
  
  <pre><code> mysql&gt; INSERT INTO courses.courses (title, length, cathegory,
   description) VALUES ('title1', 213, 1, 'description1');
  
   ERROR 1452 (23000): Cannot add or update a child row: a foreign key
   constraint fails (`courses`.`courses`, CONSTRAINT `fkPrevious` FOREIGN
   KEY (`previous`) REFERENCES `courses` (`id`)) mysql    
  </code></pre>
  
  <p>But if I insert data from phpmyadmin, all succesfully executed. Can you help me with this error?
  P.S. </p>