Probleme mit Fremdverschlüsselung in SQL Datei?

Shorty1968

Erfahrenes Mitglied
Hallo ich bin nun beim Programmieren Lernen Zwangsweisse bei MQSL gelandet und habe damit noch so meine Probleme,ich bekomme bei einer Plugin Entwicklung bei einer SQL Datei diese Fehlermeldung.
Code:
?Fatal error: Could not execute prepared statement: SQLSTATE[HY000]: General error: 1005 Can't create table 'wbb4.#sql-639_14f64' (errno: 150)Information:id: 7cc61efa6a3178887e33c5325ec1028aa81dc1ac
error message: Could not execute prepared statement: SQLSTATE[HY000]: General error: 1005 Can't create table 'wbb4.#sql-639_14f64' (errno: 150)
error code: 0
sql type: wcf\system\database\MySQLDatabase
sql error: Can't create table 'wbb4.#sql-639_14f64' (errno: 150)
sql error number: HY000
sql version: 5.1.72-2
sql query: ALTER TABLE tutorials1_tutorials ADD CONSTRAINT `343a4c4d9d76725aef67e2da6c7bc2cb_fk` FOREIGN KEY (pictureID) REFERENCES tutorials1_tutorials_picture (pictureID) ON DELETE SET NULL
file: /var/www/vhosts/wbb-support.eu/httpdocs/testforum/wbb4/wcf/lib/system/database/statement/PreparedStatement.class.php (100)
php version: 5.3.3-7+squeeze17
wcf version: 2.0.0 (Maelstrom)
date: Tue, 28 Jan 2014 15:21:25 +0000
request: /testforum/wbb4/acp/index.php/InstallPackage/?&
referer: http://wbb-support.eu/testforum/wbb4/acp/index.php/PackageInstallationConfirm/?queueID=163&
Stacktrace:#0 /var/www/vhosts/wbb-support.eu/httpdocs/testforum/wbb4/wcf/lib/system/database/editor/MySQLDatabaseEditor.class.php(169): wcf\system\database\statement\PreparedStatement->execute()
#1 /var/www/vhosts/wbb-support.eu/httpdocs/testforum/wbb4/wcf/lib/system/database/util/SQLParser.class.php(258): wcf\system\database\editor\MySQLDatabaseEditor->addForeignKey('tutorials1_tuto...', '343a4c4d9d76725...', Array)
#2 /var/www/vhosts/wbb-support.eu/httpdocs/testforum/wbb4/wcf/lib/system/package/PackageInstallationSQLParser.class.php(342): wcf\system\database\util\SQLParser->executeAddForeignKeyStatement('tutorials1_tuto...', '343a4c4d9d76725...', Array)
#3 /var/www/vhosts/wbb-support.eu/httpdocs/testforum/wbb4/wcf/lib/system/database/util/SQLParser.class.php(124): wcf\system\package\PackageInstallationSQLParser->executeAddForeignKeyStatement('tutorials1_tuto...', '343a4c4d9d76725...', Array)
#4 /var/www/vhosts/wbb-support.eu/httpdocs/testforum/wbb4/wcf/lib/system/database/util/SQLParser.class.php(49): wcf\system\database\util\SQLParser->executeStatement('ALTER TABLE', 'ALTER TABLE tut...')
#5 /var/www/vhosts/wbb-support.eu/httpdocs/testforum/wbb4/wcf/lib/system/package/plugin/SQLPackageInstallationPlugin.class.php(77): wcf\system\database\util\SQLParser->execute()
#6 /var/www/vhosts/wbb-support.eu/httpdocs/testforum/wbb4/wcf/lib/system/package/PackageInstallationDispatcher.class.php(557): wcf\system\package\plugin\SQLPackageInstallationPlugin->install()
#7 /var/www/vhosts/wbb-support.eu/httpdocs/testforum/wbb4/wcf/lib/system/package/PackageInstallationDispatcher.class.php(140): wcf\system\package\PackageInstallationDispatcher->executePIP(Array)
#8 /var/www/vhosts/wbb-support.eu/httpdocs/testforum/wbb4/wcf/lib/acp/action/InstallPackageAction.class.php(72): wcf\system\package\PackageInstallationDispatcher->install('786b7474')
#9 /var/www/vhosts/wbb-support.eu/httpdocs/testforum/wbb4/wcf/lib/action/AbstractDialogAction.class.php(70): wcf\acp\action\InstallPackageAction->stepInstall()
#10 /var/www/vhosts/wbb-support.eu/httpdocs/testforum/wbb4/wcf/lib/action/AbstractAction.class.php(49): wcf\action\AbstractDialogAction->execute()
#11 /var/www/vhosts/wbb-support.eu/httpdocs/testforum/wbb4/wcf/lib/system/request/Request.class.php(58): wcf\action\AbstractAction->__run()
#12 /var/www/vhosts/wbb-support.eu/httpdocs/testforum/wbb4/wcf/lib/system/request/RequestHandler.class.php(106): wcf\system\request\Request->execute()
#13 /var/www/vhosts/wbb-support.eu/httpdocs/testforum/wbb4/acp/index.php(10): wcf\system\request\RequestHandler->handle('wbb', true)
#14 {main}
Ich verstehe diesen Fehler nicht und weiss nicht wie ich das in der SQL Datei beheben kann?
 
Danke die SQL Läuft nun durch und es scheint als Klappt es nun bekomme ich.
Code:
Fatal error: PHP notice in file /var/www/vhosts/wbb-support.eu/httpdocs/testforum/wbb4/tutorials/lib/page/TutorialsPage.class.php (228): Undefined index: submitterInformation:id: 01a3d6809f0903a26ad5d4996b06a4f5b3f1cf0b
error message: PHP notice in file /var/www/vhosts/wbb-support.eu/httpdocs/testforum/wbb4/tutorials/lib/page/TutorialsPage.class.php (228): Undefined index: submitter
error code: 0
file: /var/www/vhosts/wbb-support.eu/httpdocs/testforum/wbb4/wcf/lib/system/WCF.class.php (297)
php version: 5.3.3-7+squeeze17
wcf version: 2.0.0 (Maelstrom)
date: Thu, 30 Jan 2014 12:30:48 +0000
request: /testforum/wbb4/tutorials/index.php/Tutorials/1-Tutorials-Test/
referer: http://wbb-support.eu/testforum/wbb4/tutorials/index.php/TutorialsAdd/

Stacktrace:#0 /var/www/vhosts/wbb-support.eu/httpdocs/testforum/wbb4/tutorials/lib/page/TutorialsPage.class.php(228): wcf\system\WCF::handleError(8, 'Undefined index...', '/var/www/vhosts...', 228, Array)
#1 /var/www/vhosts/wbb-support.eu/httpdocs/testforum/wbb4/wcf/lib/page/AbstractPage.class.php(182): tutorials\page\TutorialsPage->assignVariables()
#2 /var/www/vhosts/wbb-support.eu/httpdocs/testforum/wbb4/wcf/lib/page/AbstractPage.class.php(86): wcf\page\AbstractPage->show()
#3 /var/www/vhosts/wbb-support.eu/httpdocs/testforum/wbb4/wcf/lib/system/request/Request.class.php(58): wcf\page\AbstractPage->__run()
#4 /var/www/vhosts/wbb-support.eu/httpdocs/testforum/wbb4/wcf/lib/system/request/RequestHandler.class.php(106): wcf\system\request\Request->execute()
#5 /var/www/vhosts/wbb-support.eu/httpdocs/testforum/wbb4/tutorials/index.php(9): wcf\system\request\RequestHandler->handle('tutorials')
#6 {main}
Was ich nicht verstehe,den ich habe es in diesem teil Definiert.
Code:
 public function assignVariables() {
parent::assignVariables();

$sql = "SELECT *
FROM tutorials" . WCF_N . "_label
WHERE id = " . $this->labelID;
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute();
$label = $statement->fetchArray();

$sql = "SELECT *
FROM tutorials" . WCF_N . "_label_label
WHERE id = " . $label['label'];
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute();
$label = $statement->fetchArray();

if(!$label)
$label = array(
'id' => 0,
'title' => WCF::getLanguage()->get('tutorials.label.notAvailable'),
'color' => 'gray'
);

$submitter = new User($label['submitter']);

if(!$label)
throw new IllegalLinkException();

if($label['title'] == 1 && $label['submitter'] != WCF::getUser()->userID)
throw new PermissionDeniedException();

WCF::getTPL()->assign(array(
'submitterusername' => $submitter->username,
'responsibles' => $this->getResponsible($label['id']),
'labelname' => $label['title'],
'labelcolor' => $label['color'],
));

MessageQuoteManager::getInstance()->assignVariables();

// configuration for dashboard boxes
DashboardHandler::getInstance()->loadBoxes('wcf2tutorialssystem.TutorialsPage', $this);

WCF::getTPL()->assign(array(
'allowSpidersToIndexThisPage' => true,
'attachmentList' => $this->tutorials->getAttachments(),
'commentCanAdd' => WCF::getSession()->getPermission('user.tutorials.canWriteComment'),
'commentList' => $this->commentList,
'commentObjectTypeID' => $this->objectTypeID,
'lastCommentTime' => $this->commentList->getMinCommentTime(),
'likeData' => (MODULE_LIKE ? $this->commentList->getLikeData() : array()),
'tutorials' => $this->tutorials,
'tutorialsLikeData' => $this->tutorialsLikeData,
'sidebarCollapsed' => UserCollapsibleContentHandler::getInstance()->isCollapsed('com.woltlab.wcf.collapsibleSidebar', 'wcf2tutorialssystem.TutorialsPage'),
'sidebarName' => 'wcf2tutorialssystem.TutorialsPage',
'tags' => $this->tags,
'userProfile' => $this->userProfile,
'moreTutorialsList' => $this->moreTutorialsList
));
}
mit
Code:
$submitter = new User($label['submitter']);
diesem Code,was stimmt damit nicht?
 
Woher kommt WCF_N in Zeile 5?

Und warum arbeitest du mit prepared Stataments, wenn du sie doch nicht als solche verwendest?
 
Zurück