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