title: MySQL Error Number 150 when creating Table with Foreign Key
body: <p>I am having an issue creating a new table in my <code>database</code>. I've seen that the error code it is returning is to do with <code>Foreign Key</code> constraints. </p>
  
  <p>I checked to ensure that the <code>data type</code> of the <code>foreign key</code> in the new table matched the <code>data type</code> of the <code>primary key</code> in the other table. They are both <code>int(11)</code>. </p>
  
  <p>However I am still getting an error. Am I missing something? This is my <code>SQL</code> script for creating the new table:</p>
  
  <pre><code>CREATE TABLE `regular_features` (
    `id` INT(11) NOT NULL AUTO_INCREMENT,
    `name` VARCHAR(200) DEFAULT NULL,
    `day` VARCHAR(200) DEFAULT NULL,
    `description` TEXT DEFAULT NULL,
    `programme_id` INT(11) NOT NULL,
    PRIMARY KEY (`id`),
    FOREIGN KEY (`programme_id`) REFERENCES directoryprogramme(id) 
  ) ENGINE=INNODB DEFAULT CHARSET=utf8;
  </code></pre>
  
  <p>This is the original table  containing the <code>primary key</code>:</p>
  
  <pre><code>CREATE TABLE `directoryprogramme` (
    `id` INT(11) NOT NULL AUTO_INCREMENT,
    `name` VARCHAR(250) NOT NULL,
    `broadcast_time` VARCHAR(100) NOT NULL,
    `description` TEXT NOT NULL,
    `days` VARCHAR(150) NOT NULL,
    `contributors` VARCHAR(250) NOT NULL,
    `directorycompany_id` INT(11) NOT NULL,
    `directorycontact_id` VARCHAR(250) NOT NULL,
    `facebook_link` VARCHAR(250) DEFAULT NULL,
    `twitter_link` VARCHAR(250) DEFAULT NULL,
    `wikipedia_link` VARCHAR(250) DEFAULT NULL,
    `web` VARCHAR(250) DEFAULT NULL,
    `imageextension` VARCHAR(10) DEFAULT NULL,
    `type` VARCHAR(20) NOT NULL DEFAULT 'other',
    PRIMARY KEY (`id`)
  ) ENGINE=MYISAM AUTO_INCREMENT=1161 DEFAULT CHARSET=utf8;
  </code></pre>
  
  <p>The <code>Foreign Key</code> will be the <code>id</code> of <code>directoryprogramme</code></p>