1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.


Discussion in 'XenForo Development Discussions' started by Tristan10, Jul 29, 2016.

  1. Tristan10

    Tristan10 Member

    EDIT: I found my mistake.

    After follow this tutorial to make a basic add-on that read and writes to a database, I modified it to fit my needs. After changing some of the fields of the database (along with the primary key) in the installer.php AND in the DataWriter.php I attempted to update the add-on by exporting it and then upgrading with the XML file. This results in:

    Mysqli prepare error: 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 'UNSIGNED, PRIMARY KEY (`xbox_site_id`) ) ' at line 7

    1. Zend_Db_Statement_Mysqli->_prepare() in Zend/Db/Statement.php at line 115
    2. Zend_Db_Statement->__construct() in Zend/Db/Adapter/Mysqli.php at line 381
    3. Zend_Db_Adapter_Mysqli->prepare() in Zend/Db/Adapter/Abstract.php at line 478
    4. Zend_Db_Adapter_Abstract->query() in XboxVerification/Installer.php at line 21
    5. XboxVerification_Installer::install()
    6. call_user_func() in XenForo/Model/AddOn.php at line 215
    7. XenForo_Model_AddOn->installAddOnXml() in XenForo/Model/AddOn.php at line 169
    8. XenForo_Model_AddOn->installAddOnXmlFromFile() in XenForo/ControllerAdmin/AddOn.php at line 237
    9. XenForo_ControllerAdmin_AddOn->actionUpgrade() in XenForo/FrontController.php at line 351
    10. XenForo_FrontController->dispatch() in XenForo/FrontController.php at line 134
    11. XenForo_FrontController->run() in /home/rivalfo1/public_html/admin.php at line 13

    Here is a snippet of my installer.php:

    protected static $table = array(
    'createQuery' => 'CREATE TABLE IF NOT EXISTS `xf_xbox_verification` (
    `xbox_site_id` INT ( 9 ) NOT NULL,
    `xbox_gamertag` VARCHAR (15),
    `xbox_veriCode` INT (6) UNSIGNED,
    `xbox_xuid` VARCHAR (200),
    `xbox_attempts` INT (10) UNSIGNED,
    `xbox_date` VARCHAR (100) UNSIGNED,
    PRIMARY KEY (`xbox_site_id`)
    ENGINE = InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;',
    'dropQuery' => 'DROP TABLE IF EXISTS `xf_xbox_verification`'

    And the DataWriter:

    protected function _getFields() {
    return array(
    'xf_xbox_verification' => array(
    'xbox_site_id' => array(
    'type' => self::TYPE_UINT, 'required' => true
    'xbox_gamertag' => array(
    'type' => self::TYPE_STRING, 'required' => true
    'xbox_veriCode' => array(
    'type' => self::TYPE_UINT, 'required' => true
    'xbox_xuid' => array(
    'type' => self::TYPE_STRING, 'required' => false
    'xbox_attempts' => array(
    'type' => self::TYPE_UINT, 'required' => false
    'xbox_date' => array(
    'type' => self::TYPE_STRING, 'required' => true

    Can anyone tell me what I need to change or what I did wrong? Thanks.
    Last edited: Jul 29, 2016

Share This Page