1
我试图在PHP代码中创建一个表,以便在浏览器中打开以创建表。我需要的表内的变化的阵列,并具有正确的代码中的Oracle来创建它:在MySQL中添加变量数组(VARRAY)
CREATE TYPE ReportEntries_Type AS OBJECT
(Subject VARCHAR (500));
/
CREATE OR REPLACE TYPE ReportEntries_VA AS
VARRAY (12) OF ReportEntries_Type;
/
CREATE TABLE ReportDetails
(ReportID INTEGER NOT NULL UNIQUE,
StudentID INTEGER NOT NULL UNIQUE,
ReportEntries ReportEntries_VA,
DateLastModified DATE NOT NULL,
CONSTRAINT ReportDetails_PK PRIMARY KEY (ReportID, StudentID),
CONSTRAINT RDStudentIDSD FOREIGN KEY (StudentID)
REFERENCES StudentDetails (StudentID));
然而,当放置PHP代码中,并加入到一个MySQL数据库,将显示错误消息。我正在使用的代码如下:
<?php
require "connect_to_mysql.php";
$sqlCommand = "CREATE TYPE ReportEntries_Type AS OBJECT
...cont. code from above...
REFERENCES StudentDetails (StudentID))";
if (mysql_query ($sqlCommand)) {
echo "The ReportDetails table has been created successfully!";
} else {
echo "There has been an error";
}
?>
甚至有可能吗?提前感谢:)
哦bollocks!没关系!感谢您的快速回复@haltabush :) – 2012-03-26 16:16:34