title: InnoDB and creating relationships for table - one will not join
body: <p>This is my database:</p>
  
  <pre><code>    -- Host: localhost
  -- Generation Time: Feb 04, 2011 at 01:49 PM
  -- Server version: 5.0.45
  -- PHP Version: 5.2.5
  
  SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
  
  --
  -- Database: `myepguide`
  --
  
  -- --------------------------------------------------------   
  --
  -- Table structure for table `channel1`
  --
  
  CREATE TABLE IF NOT EXISTS `channel1` (
    `id` mediumint(255) NOT NULL auto_increment,
    `channel` varchar(255) default NULL,
    PRIMARY KEY  (`id`),
    KEY `channel` USING BTREE (`channel`)
  ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
  
  --
  -- Dumping data for table `channel1`
  --
  
  INSERT INTO `channel1` (`id`, `channel`) VALUES
  (1, '&lt;a href="channel/BBCOne.php"&gt;BBC One&lt;/a&gt;'),
  (3, '&lt;a href="channel/ITV1.php"&gt;&lt;i&gt;ITV1&lt;/i&gt;&lt;/a&gt;'),
  (2, '&lt;a href="channel/ITV2.php"&gt;&lt;i&gt;ITV2 &lt;/i&gt;&lt;/a&gt;');
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `myepguide`
  --
  
  CREATE TABLE IF NOT EXISTS `myepguide` (
    `id` mediumint(9) NOT NULL auto_increment,
    `programme` varchar(255) NOT NULL,
    `channel` varchar(255) default NULL,
    `airdate` datetime NOT NULL,
    `displayair` datetime NOT NULL,
    `expiration` datetime NOT NULL,
    `episode` varchar(255) default '',
    `setreminder` varchar(255) NOT NULL default '&lt;img src="alert.gif" height="16" width="22"&gt; &lt;a href="setreminder.php" alt="Set a reminder" target="_top"&gt;Set Reminder&lt;/a&gt;',
    PRIMARY KEY  (`id`),
    KEY `programme1` USING BTREE (`programme`),
    KEY `channel2` USING BTREE (`channel`),
    KEY `episode` (`episode`)
  ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
  
  --
  -- Dumping data for table `myepguide`
  --
  
  INSERT INTO `myepguide` (`id`, `programme`, `channel`, `airdate`, `displayair`, `expiration`, `episode`, `setreminder`) VALUES
  (1, '&lt;a href="programmes/casualty.php"&gt;Casualty&lt;/a&gt;', '&lt;a href="lib/channel/ITV1"&gt;&lt;i&gt;BBC One &lt;/i&gt;&lt;/a&gt;', '2011-05-18 14:30:00', '2011-05-18 14:30:00', '2011-05-18 15:00:00', 'No Fjords in Finland', '&lt;img src="alert.gif" height="16" width="22"&gt; &lt;a href="setreminder.php" alt="Set a reminder" target="_top"&gt;Set Reminder&lt;/a&gt;');
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `episode`
  --
  
  CREATE TABLE IF NOT EXISTS `episode` (
    `id` mediumint(9) NOT NULL auto_increment,
    `episode` varchar(255) default NULL,
    PRIMARY KEY  (`id`),
    KEY `episode` USING BTREE (`episode`)
  ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
  
  --
  -- Dumping data for table `episode`
  --
  
  INSERT INTO `episode` (`id`, `episode`) VALUES
  (1, 'No Fjords in Finland'),
  (2, 'Casualty 25th Special'),
  (3, '&lt;a href="Holby1.php"&gt;Palimpsest&lt;/a&gt;');
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `programme`
  --
  
  CREATE TABLE IF NOT EXISTS `programme` (
    `id` mediumint(255) NOT NULL auto_increment,
    `programme` varchar(255) default NULL,
    PRIMARY KEY  (`id`),
    KEY `programme1` USING BTREE (`programme`)
  ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
  
  --
  -- Dumping data for table `programme`
  --
  
  INSERT INTO `programme` (`id`, `programme`) VALUES
  (1, '&lt;a href="programmes/casualty.php"&gt;Casualty&lt;/a&gt;');
  
  --
  -- Constraints for dumped tables
  --
  
  --
  -- Constraints for table `myepguide`
  --
  ALTER TABLE `myepguide`
    ADD CONSTRAINT `myepguide_ibfk_1` FOREIGN KEY (`programme`) REFERENCES `myepguide` (`programme`) ON UPDATE CASCADE,
    ADD CONSTRAINT `myepguide_ibfk_2` FOREIGN KEY (`channel`) REFERENCES `channel1` (`channel`) ON DELETE SET NULL ON UPDATE CASCADE;
  </code></pre>
  
  <p>I cannot get the 'episode` table to link to that in the table <strong>myepguide</strong> for some reason, in Phpmyadmin it always says "Relation not added".</p>
  
  <p>Deleting and re-creating it did not work either, so how can I fix this?</p>
  
  <p><strong>All are stored in InnoDB format</strong> so I can't understand why this happened.</p>
  
  <p>Any help is appreciated!</p>