1
我想運行腳本來創建Magento中的自定義表 但它會給出錯誤。 這是我的腳本 -Magento創建表錯誤
<?php
$installer = $this;
$installer->startSetup();
$installer->run("
-- DROP TABLE IF EXISTS {$this->getTable('module')};
CREATE TABLE {$this->getTable('module')} (
'module_id' int(11) unsigned NOT NULL auto_increment,
'cust_id' varchar(20) NOT NULL,
PRIMARY KEY (`module_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
");
$installer->endSetup();
我的錯誤日誌看起來像這樣。
PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error
in your SQL syntax; check the manual that corresponds to your MySQL server version for
the right syntax to use near ''module_id' int(11) unsigned NOT NULL auto_increment,
'cust_id' varchar(20) NO' at line 3 in
C:\wamp\www\magento\lib\Zend\Db\Statement\Pdo.php on line 228
Call Stack
/#TimeMemoryFunctionLocation
10.0019379872{main}()..\index.php:0
20.0114765224Mage::run()..\index.php:87
30.03492000528Mage_Core_Model_App->run()..\Mage.php:683
40.06713061480Mage_Core_Model_App->_initModules()..\App.php:343
51.13563312608Mage_Core_Model_Resource_Setup::applyAllUpdates()..\App.php:417
61.22758029488Mage_Core_Model_Resource_Setup->applyUpdates()..\Setup.php:235
71.22798027824Mage_Core_Model_Resource_Setup->_installResourceDb()..\Setup.php:327
81.22798027920Mage_Core_Model_Resource_Setup->_modifyResourceDb()..\Setup.php:421
91.23228033648include('C:\wamp\www\magento\app\code\community\module\sql\module_setup\mysql4-install-0.1.0.php')..\Setup.php:624
101.23558112592Mage_Core_Model_Resource_Setup->run()..\mysql4-install-0.1.0.php:13
111.23558112592Varien_Db_Adapter_Pdo_Mysql->multiQuery()..\Setup.php:933
121.23558112592Varien_Db_Adapter_Pdo_Mysql->multi_query()..\Mysql.php:590)
我正在運行magento 1.7和mysql版本5.5.24。 任何線索? 謝謝!
是的,我只是想通了出來。儘管非常感謝你,但我會盡快接受你的回答:) – BlahBlah