【问题标题】:Error when creating a relational database in phpMyAdmin在 phpMyAdmin 中创建关系数据库时出错
【发布时间】:2014-09-21 21:24:26
【问题描述】:

我正在尝试在 phpMyAdmin 中创建关系 MySQL 数据库。基本的表结构是这样的:

productsTbl:

ID(主键,int,11), 名称(varchar,20), 颜色ID(整数,02)

colorsTbl:

ID(主键,int 11), 颜色(varchar,20)

我正在尝试在 coloursTbl 中的 ID 和 producsTbl 中的 ColourID 之间的设计选项卡上创建关系,但出现以下错误:

{
    "exception": {
        "mode": "onerror",
        "message": "Uncaught TypeError: Cannot read property 'document' of undefined",
        "stack": [
            {
                "line": 16,
                "func": "PrintXML",
                "context": [
                    "{",
                    "    var $root = $(data).find('root');",
                    "    if ($root.length === 0) {",
                    "        // error",
                    "        var myWin = window.open('', 'Report', 'width=400, height=250, resiz//...",
                    "        var tmp = myWin.document;",
                    "        tmp.write(data);",
                    "        tmp.close();",
                    "    } else {",
                    "        // success",
                    "        if ($root.attr('act') == 'save_pos') {"
                ],
                "filename": "pmd/ajax.js"
            }
        ],
        "useragent": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36",
        "uri": "pmd_general.php?target="
    },
    "script_name": "pmd_general.php",
    "pma_version": "4.1.12",
    "browser_name": "CHROME",
    "browser_version": "36.0.1985.125",
    "user_os": "Win",
    "server_software": "Apache/2.4.9 (Win32) OpenSSL/1.0.1g PHP/5.5.11",
    "user_agent_string": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36",
    "locale": "en",
    "configuration_storage": "enabled",
    "php_version": "5.5.11",
    "microhistory": {
        "pages": [
            {
                "hash": "tbl_change.php?db=test&table=colours&server=1&target=&token=fdc2fa4ced95c29ba26a3e2d58afb9ef",
                "params": {
                    "opendb_url": "db_structure.php",
                    "safari_browser": "0",
                    "querywindow_height": "400",
                    "querywindow_width": "600",
                    "collation_connection": "utf8mb4_general_ci",
                    "lang": "en",
                    "server": "1",
                    "text_dir": "ltr",
                    "pma_text_default_tab": "Browse",
                    "pma_text_left_default_tab": "Structure",
                    "confirm": "true"
                }
            },
            {
                "hash": "tbl_replace.php?db=test&table=colours&server=1&target=&token=fdc2fa4ced95c29ba26a3e2d58afb9ef",
                "params": {
                    "opendb_url": "db_structure.php",
                    "safari_browser": "0",
                    "querywindow_height": "400",
                    "querywindow_width": "600",
                    "collation_connection": "utf8mb4_general_ci",
                    "lang": "en",
                    "server": "1",
                    "text_dir": "ltr",
                    "pma_text_default_tab": "Browse",
                    "pma_text_left_default_tab": "Structure",
                    "confirm": "true"
                }
            },
            {
                "hash": "tbl_change.php?db=test&table=colours&server=1&target=&token=fdc2fa4ced95c29ba26a3e2d58afb9ef",
                "params": {
                    "opendb_url": "db_structure.php",
                    "safari_browser": "0",
                    "querywindow_height": "400",
                    "querywindow_width": "600",
                    "collation_connection": "utf8mb4_general_ci",
                    "lang": "en",
                    "server": "1",
                    "text_dir": "ltr",
                    "pma_text_default_tab": "Browse",
                    "pma_text_left_default_tab": "Structure",
                    "confirm": "true"
                }
            },
            {
                "hash": "tbl_replace.php?db=test&table=colours&server=1&target=&token=fdc2fa4ced95c29ba26a3e2d58afb9ef",
                "params": {
                    "opendb_url": "db_structure.php",
                    "safari_browser": "0",
                    "querywindow_height": "400",
                    "querywindow_width": "600",
                    "collation_connection": "utf8mb4_general_ci",
                    "lang": "en",
                    "server": "1",
                    "text_dir": "ltr",
                    "pma_text_default_tab": "Browse",
                    "pma_text_left_default_tab": "Structure",
                    "confirm": "true"
                }
            },
            {
                "hash": "sql.php?db=test&table=colours&server=1&target=&token=fdc2fa4ced95c29ba26a3e2d58afb9ef",
                "params": {
                    "opendb_url": "db_structure.php",
                    "safari_browser": "0",
                    "querywindow_height": "400",
                    "querywindow_width": "600",
                    "collation_connection": "utf8mb4_general_ci",
                    "lang": "en",
                    "server": "1",
                    "text_dir": "ltr",
                    "pma_text_default_tab": "Browse",
                    "pma_text_left_default_tab": "Structure",
                    "confirm": "true"
                }
            },
            {
                "hash": "db_structure.php?db=test&table=&server=1&target=&token=fdc2fa4ced95c29ba26a3e2d58afb9ef",
                "params": {
                    "opendb_url": "db_structure.php",
                    "safari_browser": "0",
                    "querywindow_height": "400",
                    "querywindow_width": "600",
                    "collation_connection": "utf8mb4_general_ci",
                    "lang": "en",
                    "server": "1",
                    "text_dir": "ltr",
                    "pma_text_default_tab": "Browse",
                    "pma_text_left_default_tab": "Structure",
                    "confirm": "true"
                }
            },
            {
                "hash": "pmd_general.php?db=test&table=&server=1&target=&token=fdc2fa4ced95c29ba26a3e2d58afb9ef",
                "params": {
                    "opendb_url": "db_structure.php",
                    "safari_browser": "0",
                    "querywindow_height": "400",
                    "querywindow_width": "600",
                    "collation_connection": "utf8mb4_general_ci",
                    "lang": "en",
                    "server": "1",
                    "text_dir": "ltr",
                    "pma_text_default_tab": "Browse",
                    "pma_text_left_default_tab": "Structure",
                    "confirm": "true"
                }
            }
        ],
        "current_index": "7"
    }
}

这是什么意思??

【问题讨论】:

  • 为什么不在脚本代码中建立关​​系?哪里会出现这个错误?
  • 这是我在尝试通过 phpMyAdmin 中的设计选项卡创建关系时在错误报告中得到的错误。我使用管理控制台,而不是使用书面脚本
  • 你使用的是phpMyAdmin 4.1.12,已经过时了。

标签: php mysql sql phpmyadmin


【解决方案1】:

我遇到了同样的问题,并使用以下步骤进行了更正:

1) 转到产品表

2) 转到结构

3) 在 ColourID 列上单击索引

4) 返回并创建关系

这将解决您的问题

【讨论】:

  • 我遇到了同样的错误,这对我有帮助。这应该被接受为正确答案。谢谢@SystemX17
  • 对我来说同样的问题,这个回答是正确的解决方案
猜你喜欢
  • 2012-11-16
  • 1970-01-01
  • 1970-01-01
  • 2012-04-09
  • 1970-01-01
  • 2017-08-06
  • 2015-10-24
  • 2021-06-21
  • 2020-03-03
相关资源
最近更新 更多