在phpMyAdmin中创建关系数据库时出错

时间:2014-07-30 09:35:23

标签: php mysql sql phpmyadmin

我正在尝试在phpMyAdmin中创建关系型MySQL数据库。基本的表结构如下:

productsTbl:

ID(主键,int,11), 名称(varchar,20), ColourID(int,02)

coloursTbl:

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"
    }
}

这意味着什么?

1 个答案:

答案 0 :(得分:3)

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

1)转到产品表

2)转到结构

3)在ColourID列上单击索引

4)回去创建关系

这将解决您的问题