PHPMyAdmin - InnoDB 表不会加入

发布于 2024-11-18 10:09:33 字数 2686 浏览 1 评论 0原文

这是我的数据库结构:

    CREATE database mytvguide

    CREATE TABLE IF NOT EXISTS `channels` (
      `id` int(11) NOT NULL auto_increment,
      `channel1` varchar(255) NOT NULL,
      PRIMARY KEY  (`id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

    CREATE TABLE IF NOT EXISTS `episodeairings` (
  `id` mediumint(255) unsigned NOT NULL auto_increment,
  `programme` varchar(255) collate utf8_unicode_ci NOT NULL,
  `channel` varchar(255) collate utf8_unicode_ci default NULL,
  `airdate` datetime default NULL,
  `displayair` datetime default NULL,
  `expiration` datetime default NULL,
  `epname` varchar(256) collate utf8_unicode_ci NOT NULL,
  `epno` mediumint(255) unsigned NOT NULL,
  `epseries` mediumint(255) unsigned NOT NULL,
  `setreminder` varchar(255) collate utf8_unicode_ci default NULL,
  PRIMARY KEY  (`id`),
  KEY `channel` (`channel`),
  KEY `programme` (`programme`),
  KEY `setreminder` (`setreminder`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=DYNAMIC AUTO_INCREMENT=3 ;
INSERT INTO `episodeairings` (`id`, `programme`, `channel`, `airdate`, `displayair`, `expiration`, `epname`, `setreminder`) VALUES
(1, 'TV Programme 1', 'ITV2', '2011-07-09 22:35:00', '2011-06-30 22:35:00', '2011-06-30 23:05:00', 'Episode', '' , '', NULL),
(2, 'TV Programme 1', 'ITV2', '2011-07-10 02:25:00', '2011-07-01 02:25:00', '2011-07-01 02:55:00', 'EpisodeTest', '1', '2', NULL);
CREATE TABLE IF NOT EXISTS `episode` (
  `id` int(11) NOT NULL auto_increment,
  `epname` varchar(255) NOT NULL,
  `seriesnumber` int(11) NOT NULL,
  `episodenumber` int(11) NOT NULL,
  PRIMARY KEY  (`id`),
  UNIQUE KEY `epname` (`epname`),
  KEY `seriesnumber` (`seriesnumber`),
  KEY `episodenumber` (`episodenumber`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;


INSERT INTO `episode` (`id`, `epname`, `seriesnumber`, `episodenumber`) VALUES
(1, 'Episode', 1, 1);

CREATE TABLE IF NOT EXISTS `programme1` (
  `id` int(11) NOT NULL auto_increment,
  `programme` varchar(255) NOT NULL default '<a href="pca1.php">Police, Camera, Action!</a>',
  PRIMARY KEY  (`id`),
  KEY `programme` (`programme`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;


INSERT INTO `programme1` (`id`, `programme`) VALUES
(1, '<a href="prog1.php">TV Programme 1</a>');

INSERT INTO `channels` (`id`, `channel`) VALUES
(1, '<a href="TV2.php">ITV2</a>');

出于某种原因,我无法将 Episodeairings 中的任何表 - 即节目、频道、播出日期、epname、epno、epseries 与其他表中的表链接起来 (分别是节目、EP 名称、系列号、剧集号)。 基本上,对于链接表来说,下拉列表根本不会发生,而它应该发生。

尽管事实上我的数据库通过 PHPmyadmin 存储为 InnoDB 并且我设置了链接表。

这是为什么?我该如何解决它?

This is my database structure:

    CREATE database mytvguide

    CREATE TABLE IF NOT EXISTS `channels` (
      `id` int(11) NOT NULL auto_increment,
      `channel1` varchar(255) NOT NULL,
      PRIMARY KEY  (`id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

    CREATE TABLE IF NOT EXISTS `episodeairings` (
  `id` mediumint(255) unsigned NOT NULL auto_increment,
  `programme` varchar(255) collate utf8_unicode_ci NOT NULL,
  `channel` varchar(255) collate utf8_unicode_ci default NULL,
  `airdate` datetime default NULL,
  `displayair` datetime default NULL,
  `expiration` datetime default NULL,
  `epname` varchar(256) collate utf8_unicode_ci NOT NULL,
  `epno` mediumint(255) unsigned NOT NULL,
  `epseries` mediumint(255) unsigned NOT NULL,
  `setreminder` varchar(255) collate utf8_unicode_ci default NULL,
  PRIMARY KEY  (`id`),
  KEY `channel` (`channel`),
  KEY `programme` (`programme`),
  KEY `setreminder` (`setreminder`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=DYNAMIC AUTO_INCREMENT=3 ;
INSERT INTO `episodeairings` (`id`, `programme`, `channel`, `airdate`, `displayair`, `expiration`, `epname`, `setreminder`) VALUES
(1, 'TV Programme 1', 'ITV2', '2011-07-09 22:35:00', '2011-06-30 22:35:00', '2011-06-30 23:05:00', 'Episode', '' , '', NULL),
(2, 'TV Programme 1', 'ITV2', '2011-07-10 02:25:00', '2011-07-01 02:25:00', '2011-07-01 02:55:00', 'EpisodeTest', '1', '2', NULL);
CREATE TABLE IF NOT EXISTS `episode` (
  `id` int(11) NOT NULL auto_increment,
  `epname` varchar(255) NOT NULL,
  `seriesnumber` int(11) NOT NULL,
  `episodenumber` int(11) NOT NULL,
  PRIMARY KEY  (`id`),
  UNIQUE KEY `epname` (`epname`),
  KEY `seriesnumber` (`seriesnumber`),
  KEY `episodenumber` (`episodenumber`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;


INSERT INTO `episode` (`id`, `epname`, `seriesnumber`, `episodenumber`) VALUES
(1, 'Episode', 1, 1);

CREATE TABLE IF NOT EXISTS `programme1` (
  `id` int(11) NOT NULL auto_increment,
  `programme` varchar(255) NOT NULL default '<a href="pca1.php">Police, Camera, Action!</a>',
  PRIMARY KEY  (`id`),
  KEY `programme` (`programme`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;


INSERT INTO `programme1` (`id`, `programme`) VALUES
(1, '<a href="prog1.php">TV Programme 1</a>');

INSERT INTO `channels` (`id`, `channel`) VALUES
(1, '<a href="TV2.php">ITV2</a>');

For some reason I can't link any of the tables in episodeairings - namely programme, channel, airdate, epname, epno, epseries with those in the other tables
(which are programme, epname, seriesnumber, episodenumber).
Basically, the dropdown won't happen at all for linked tables, as it should do.

This is despite the fact my database is stored as InnoDB via PHPmyadmin and I set the linked tables.

Why is this and how can I fix it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

野生奥特曼 2024-11-25 10:09:33

我不确定 phpmyadmin 是如何工作的,但我假设它要求您在表之间定义一些外键约束(例如使用 alter table 语句)。

请参阅更改表文档: http://dev.mysql.com/ doc/refman/5.1/en/alter-table.html

I am not sure how phpmyadmin works but I would assume that it requires you to define some foreign key constraints between your tables (e.g. using the alter table statement).

See alter table docs: http://dev.mysql.com/doc/refman/5.1/en/alter-table.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文