SQL Error beim Installieren von AddOn

McAtze

Administrator
Lizenzinhaber
Registriert
30. Apr. 2011
Beiträge
6.107
Punkte
523
XF Version
  1. 2.3 Beta
XF Instanz
Hosting
PHP-Version
8.3.4
MySQL/MariaDB
10.11
Provider/Hoster
Netcup
Hi,

irgendwie will sich meine AddOn nicht installieren lassen. Ich bekomme immer diesem Fehler..
Code:
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 '' at line 27

Die Installationsdatei ist folgende..
PHP:
<?php

/**
* Handles Advents Calendar installation and upgrades.
*
* @author      McAtze
* @copyright 
* @link      
* @package     Advents Calendar
*/
class McA_AdventCalendar_Installer_Install
{
    private static $_instance;

    protected $_db;
  
    public static final function getInstance()
    {
        if (!self::$_instance)
        {
            self::$_instance = new self;
        }

        return self::$_instance;
    }
  
    protected function _getDb()
    {
        if ($this->_db === null)
        {
            $this->_db = XenForo_Application::get('db');
        }

        return $this->_db;
    }
  
    public static function install($existingAddOn, $addOnData)
    {
        if (XenForo_Application::$versionId < 1020051)
        {
            throw new XenForo_Exception('Advent Calendar requires XenForo 1.2.0 RC 1 or newer to proceed.', true);  
        }
              
        $startVersion = 1;
        $endVersion = $addOnData['version_id'];

        if ($existingAddOn)
        {
            $startVersion = $existingAddOn['version_id'] + 1;
        }

        $install = self::getInstance();

        for ($i = $startVersion; $i <= $endVersion; $i++)
        {
            $method = '_installVersion' . $i;

            if (method_exists($install, $method) === false)
            {
                continue;
            }

            $install->$method();
        }
    }

    protected function _installVersion1()
    {
        $db = $this->_getDb();
      
        $db->query("      
            CREATE TABLE IF NOT EXISTS xf_adventcalendar_days (
                adventcalendar_daysid int(11) NOT NULL auto_increment,
                active smallint(1) NOT NULL default '0',
                  image text NOT NULL,
                  data text NOT NULL,
                  bitfield int(4) NOT NULL default '0',
                  pwidth int(4) NOT NULL default '0',
                  pheight int(4) NOT NULL default '0',
                PRIMARY KEY  (adventcalendar_daysid)
                )
                ENGINE = InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci
        ");  

        $db->query("
            INSERT INTO xf_adventcalendar_days
                (adventcalendar_daysid, active, image, data, bitfield, pwidth, pheight)
            VALUES
                ('', 0, '', '<object width=\"425\" height=\"344\"><param name=\"movie\" value=\"http://www.youtube.com/v/tpHy2lQimYA&hl=en&fs=1\"></param><param name=\"allowFullScreen\" value=\"true\"></param><param name=\"allowscriptaccess\" value=\"always\"></param><embed src=\"http://www.youtube.com/v/tpHy2lQimYA&hl=en&fs=1\" type=\"application/x-shockwave-flash\" allowscriptaccess=\"always\" allowfullscreen=\"true\" width=\"425\" height=\"344\"></embed></object>', 2, 425, 344),
                ('', 0, 'http://www.funny-animals.org/wp-content/funny-animals/christmas_kitten.jpg', '', 1, 512, 384),
                ('', 0, '', '<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" width=\"728\" height=\"450\"><param name=\"movie\" value=\"http://www.cooking-games.biz/swf/christmas-cookie-treats.swf\"><param name=\"quality\" value=\"high\"><param name=\"menu\" value=\"true\"><embed width=\"728\" height=\"450\" src=\"http://www.cooking-games.biz/swf/christmas-cookie-treats.swf\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\"></embed></object>', 2, 728, 450),
                ('', 0, '', '<object height=\"285\" width=\"470\"><param name=\"allowScriptAccess\" value=\"always\"><param name=\"movie\" value=\"http://www.myvideo.de/movie/5680630\"><param name=\"quality\" value=\"high\"><param name=\"bgcolor\" value=\"#000000\"><embed src=\"http://www.myvideo.de/movie/5680630\" quality=\"high\" allowscriptaccess=\"always\" type=\"application/x-shockwave-flash\" align=\"middle\" height=\"285\" width=\"470\"></embed></object>', 2, 470, 285),
                ('', 0, '', '<object width=\"400\" height=\"326\"><param name=\"allowFullScreen\" value=\"true\"></param><embed src=\"http://video.google.ca/googleplayer.swf?docid=3004558882065367546&hl=en-CA&fs=true\" width=\"400\" height=\"326\" allowFullScreen=\"true\" allowScriptAccess=\"always\" type=\"application/x-shockwave-flash\"></embed></object>', 2, 410, 325),
                ('', 0, 'http://images.paraorkut.com/img/funnypics/images/s/santa_and_robber-12085.gif', '', 1, 430, 281),
                ('', 0, '', '<object width=\"425\" height=\"355\"><param name=\"movie\" value=\"http://www.youtube.com/v/zmQDt7jVdXQ\"></param><param name=\"allowFullScreen\" value=\"true\"></param><param name=\"allowscriptaccess\" value=\"always\"></param><embed src=\"http://www.youtube.com/v/zmQDt7jVdXQ\" type=\"application/x-shockwave-flash\" allowscriptaccess=\"always\" allowfullscreen=\"true\" width=\"425\" height=\"355\"></embed></object>', 2, 425, 355),
                ('', 0, 'http://www.phuketwatch.com/maithai/images/jokes/xmas.jpg', '', 1, 560, 783),
                ('', 0, '', '<object height=\"285\" width=\"470\"><param name=\"allowScriptAccess\" value=\"always\"><param name=\"movie\" value=\"http://www.myvideo.de/movie/1451030\"><param name=\"quality\" value=\"high\"><param name=\"bgcolor\" value=\"#000000\"><embed src=\"http://www.myvideo.de/movie/1451030\" quality=\"high\" allowscriptaccess=\"always\" type=\"application/x-shockwave-flash\" align=\"middle\" height=\"285\" width=\"470\"></embed></object>', 2, 470, 285),
                ('', 0, '', '<object width=\"425\" height=\"344\"><param name=\"movie\" value=\"http://www.youtube.com/v/dQQruRTuq9I&hl=en&fs=1\"></param><param name=\"allowFullScreen\" value=\"true\"></param><param name=\"allowscriptaccess\" value=\"always\"></param><embed src=\"http://www.youtube.com/v/dQQruRTuq9I&hl=en&fs=1\" type=\"application/x-shockwave-flash\" allowscriptaccess=\"always\" allowfullscreen=\"true\" width=\"425\" height=\"344\"></embed></object>', 2, 425, 344),
                ('', 0, 'http://www.desktopexchange.com/gallery/albums/Christmas-wallpaper/Christmas_Funny_police.jpg', '', 1, 1024, 768),
                ('', 0, '', '<object width=\"425\" height=\"350\"><param name=\"movie\" value=\"http://www.youtube.com/v/wskT6YfVB6E\"></param><param name=\"wmode\" value=\"transparent\"></param><embed src=\"http://www.youtube.com/v/wskT6YfVB6E\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" width=\"410\" height=\"325\"></embed></object>', 2, 425, 350),
                ('', 0, '', '<object width=\"480\" height=\"385\"><param name=\"movie\" value=\"http://www.youtube.com/v/Tmb8bcJPTFM\"></param><param name=\"allowFullScreen\" value=\"true\"></param><param name=\"allowscriptaccess\" value=\"always\"></param><embed src=\"http://www.youtube.com/v/Tmb8bcJPTFM\" type=\"application/x-shockwave-flash\" allowscriptaccess=\"always\" allowfullscreen=\"true\" width=\"480\" height=\"385\"></embed></object>', 2, 480, 385),
                ('', 0, '', '<object width=\"425\" height=\"350\"><param name=\"movie\" value=\"http://www.youtube.com/v/LuiyWGIzVRw\"></param><param name=\"wmode\" value=\"transparent\"></param><embed src=\"http://www.youtube.com/v/LuiyWGIzVRw\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" width=\"410\" height=\"325\"></embed></object>', 2, 425, 350),
                ('', 0, '', '<object width=\"425\" height=\"350\"><param name=\"movie\" value=\"http://www.youtube.com/v/uexTqnlMbXg\"></param><embed src=\"http://www.youtube.com/v/uexTqnlMbXg\" type=\"application/x-shockwave-flash\" width=\"425\" height=\"350\"></embed></object>', 2, 425, 350),
                ('', 0, '', '<object width=\"425\" height=\"350\"><param name=\"movie\" value=\"http://www.youtube.com/v/BXXgAS_1Ifc\"></param><param name=\"wmode\" value=\"transparent\"></param><embed src=\"http://www.youtube.com/v/BXXgAS_1Ifc\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" width=\"410\" height=\"325\"></embed></object>', 2, 425, 350),
                ('', 0, '', '<object width=\"480\" height=\"385\"><param name=\"movie\" value=\"http://www.youtube.com/v/Pw4arCQ6FE4\"></param><param name=\"allowFullScreen\" value=\"true\"></param><param name=\"allowscriptaccess\" value=\"always\"></param><embed src=\"http://www.youtube.com/v/Pw4arCQ6FE4\" type=\"application/x-shockwave-flash\" allowscriptaccess=\"always\" allowfullscreen=\"true\" width=\"480\" height=\"385\"></embed></object>', 2, 480, 385),
                ('', 0, '', '<object width=\"640\" height=\"385\"><param name=\"movie\" value=\"http://www.youtube.com/v/PCm82O35VT8\"></param><param name=\"allowFullScreen\" value=\"true\"></param><param name=\"allowscriptaccess\" value=\"always\"></param><embed src=\"http://www.youtube.com/v/PCm82O35VT8\" type=\"application/x-shockwave-flash\" allowscriptaccess=\"always\" width=\"640\" height=\"385\"></embed></object>', 2, 640, 385),
                ('', 0, '', '<object width=\"480\" height=\"385\"><param name=\"movie\" value=\"http://www.youtube.com/v/muWFHlW-s-o\"></param><param name=\"allowFullScreen\" value=\"true\"></param><param name=\"allowscriptaccess\" value=\"always\"></param><embed src=\"http://www.youtube.com/v/muWFHlW-s-o\" type=\"application/x-shockwave-flash\" allowscriptaccess=\"always\" allowfullscreen=\"true\" width=\"480\" height=\"385\"></embed></object>', 2, 480, 385),
                ('', 0, '', '<object width=\"480\" height=\"385\"><param name=\"movie\" value=\"http://www.youtube.com/v/QPG_xqp1QaM\"></param><param name=\"allowFullScreen\" value=\"true\"></param><param name=\"allowscriptaccess\" value=\"always\"></param><embed src=\"http://www.youtube.com/v/QPG_xqp1QaM\" type=\"application/x-shockwave-flash\" allowscriptaccess=\"always\" allowfullscreen=\"true\" width=\"480\" height=\"385\"></embed></object>', 2, 480, 385),
                ('', 0, 'http://www.n00b-hackz.de/zello/muster/wallpaper/xmas.jpg', '', 1, 955, 764),
                ('', 0, '', '<object width=\"480\" height=\"385\"><param name=\"movie\" value=\"http://www.youtube.com/v/-YB1BeDT84s\"></param><param name=\"allowFullScreen\" value=\"true\"></param><param name=\"allowscriptaccess\" value=\"always\"></param><embed src=\"http://www.youtube.com/v/-YB1BeDT84s\" type=\"application/x-shockwave-flash\" allowscriptaccess=\"always\" allowfullscreen=\"true\" width=\"480\" height=\"385\"></embed></object>', 2, 480, 385),
                ('', 0, '', '<object width=\"480\" height=\"385\"><param name=\"movie\" value=\"http://www.youtube.com/v/ONyXSnL2LtA\"></param><param name=\"allowFullScreen\" value=\"true\"></param><param name=\"allowscriptaccess\" value=\"always\"></param><embed src=\"http://www.youtube.com/v/ONyXSnL2LtA\" type=\"application/x-shockwave-flash\" allowscriptaccess=\"always\" allowfullscreen=\"true\" width=\"480\" height=\"385\"></embed></object>', 2, 480, 385),
                ('', 0, '', '<object height=\"285\" width=\"470\"><param name=\"allowScriptAccess\" value=\"always\"><param name=\"movie\" value=\"http://www.myvideo.de/movie/5945120\"><param name=\"quality\" value=\"high\"><param name=\"bgcolor\" value=\"#000000\"><embed src=\"http://www.myvideo.de/movie/5945120\" quality=\"high\" allowscriptaccess=\"always\" type=\"application/x-shockwave-flash\" align=\"middle\" height=\"285\" width=\"470\"></embed></object>', 2, 470, 285),
        ");      
              
    }
      
}

Sieht denn einer von euch den Fehler ??
 
Mach mal bei den Inserts das letzte Komma weg und ein Semikolon hin.

Weiterhin schreibst du Strings in INT Felder. (adventcalender_daysid).

Lass die Spalte einfach weg, ist doch autoincrement.
 
Weiterhin schreibst du Strings in INT Felder. (adventcalender_daysid).
Lass die Spalte einfach weg, ist doch autoincrement.
Du meinst komplett bei INSERT INTO und bei VALUES?
 
In der letzten Zeile.

Tipp: nimm die Querys und führe sie aus.

Wenn du eine UI brauchst für Datenbanken, nimm HeidiSQL. Der ist wirklich Top!
 
Ich wäre (fast) einmal Oracle DBA geworden .. Leider nur fast.
Muss mich wieder mehr mit der Materie beschäftigen. ;)

Danke für den Link.
 
Zurück
Oben