Seite 1 von 2

Unbekannter SQL-Fehler - 0 GROUP BY t.topic_id

Verfasst: 15.03.2012 17:46
von Michel_61
Hallo,

zu Testzwecken hab ich ein phpbb frisch aufgesetzt, Primetime und social Network installiert. Danach trat ein Fehler auf den ich nicht reproduzieren kann.
Das forum selbst, auch das ACP, funktioniert alles einwandfrei. Nur wenn ich mich abmelde erscheint folgender Fehler:
Allgemeiner Fehler
SQL ERROR [ mysqli ]

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 't.topic_approved <> 0 GROUP BY t.topic_id ORDER BY t.topic_time DESC' at line 5 [1064]

Beim Laden der Seite ist ein SQL-Fehler aufgetreten. Bitte kontaktiere die Board-Administration, falls dieses Problem fortlaufend auftritt.
Kann mir jemand sagen um was es hier geht? Und wie ich da ran komme?

EDIT: Angemeldet, funktioniert wieder alles einwandfrei, irgendwie muss das mit der ansicht des Forums als Gast zu tun haben.....

Re: Unbekannter SQL-Fehler - 0 GROUP BY t.topic_id

Verfasst: 16.03.2012 13:36
von Miriam
Kannst du denn sehen, wie die gesamte SQL Query aussieht? Die scheint irgendwo auf Zeile 5 zu stehen.

Re: Unbekannter SQL-Fehler - 0 GROUP BY t.topic_id

Verfasst: 16.03.2012 14:14
von Michel_61
Hallo,

nee, irgendwie hatte ich bisher noch nie was mit sql-query zu tun gehabt. Ich wüsste jetzt auch nicht wo ich danach suchen sollte.

Ist das denn eine Datei? Oder eine Datenbanktabelle? Weder auf dem Server, noch in der DB konnte ich da was finden.... :oops: :oops:

Re: Unbekannter SQL-Fehler - 0 GROUP BY t.topic_id

Verfasst: 16.03.2012 14:27
von Miriam
Schalt mal bitte deb Debug-Modus ein, indem du in der config.php diese zeilen von den Kommentarzeichen befreist:

Code: Alles auswählen

// @define('DEBUG', true);
// @define('DEBUG_EXTRA', true);  
Und schau dann mal, ob etwas mehr an Infos rum kommt.

Re: Unbekannter SQL-Fehler - 0 GROUP BY t.topic_id

Verfasst: 16.03.2012 14:47
von Michel_61
Hallo, jo, die Gesichtszüge erhellen sich :grin:

jetzt kommt der Fehler wie folgt:
SQL ERROR [ mysqli ]

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 't.topic_approved <> 0 GROUP BY t.topic_id ORDER BY t.topic_time DESC' at line 5 [1064]

SQL

SELECT DISTINCT c.cat_id, c.cat_name, t.topic_id FROM (phpbb_categories c CROSS JOIN phpbb_categories_data d CROSS JOIN phpbb_topics t) WHERE d.cat_id = c.cat_id AND d.item_id = t.topic_id AND d.module = 'content' AND t.forum_id = 5 AND t.topic_tag = 'news'AND d.cat_id = 2AND t.topic_approved <> 0 GROUP BY t.topic_id ORDER BY t.topic_time DESC

BACKTRACE

FILE: [ROOT]/includes/db/mysqli.php
LINE: 182
CALL: dbal->sql_error()

FILE: [ROOT]/modules/content/cms_content.php
LINE: 201
CALL: dbal_mysqli->sql_query()

FILE: [ROOT]/includes/functions_module.php
LINE: 529
CALL: cms_content->main()

FILE: [ROOT]/index.php
LINE: 58
CALL: p_master->load_active()
nur so richtig schlau daraud geworden bin ich trotzdem noch nicht.

EDIT: Soweit ich bislang rauslesen konnte, Index.php, und die beiden Fehlermeldungen davor, kommt das vom Primetime-MOD. Tja, da ist alles in englisch, also mit Bananen gehandelt....

Re: Unbekannter SQL-Fehler - 0 GROUP BY t.topic_id

Verfasst: 16.03.2012 14:57
von Perlchamp
Hi,
SELECT DISTINCT c.cat_id, c.cat_name, t.topic_id FROM (phpbb_categories c CROSS JOIN phpbb_categories_data d CROSS JOIN phpbb_topics t) WHERE d.cat_id = c.cat_id AND d.item_id = t.topic_id AND d.module = 'content' AND t.forum_id = 5 AND t.topic_tag = 'news'AND d.cat_id = 2AND t.topic_approved <> 0 GROUP BY t.topic_id ORDER BY t.topic_time DESC
das hier könnte der Fehler:
t.topic_tag = 'news'AND d.cat_id = 2AND t.t
da müssen Leerzeichen zwischen "newsAND" und "2AND" rein, also vor dem "AND" jeweils ein Leerzeichen ...
eventuell die Zahlen 5, 2 und 0 in Hochkommata stellen, wie dies bei "content" der Fall ist (bei Zahlen muss dies aber nicht zwangsläufig sein.)

Viel Glück
so long

Re: Unbekannter SQL-Fehler - 0 GROUP BY t.topic_id

Verfasst: 16.03.2012 15:02
von Michel_61
Hi, jaa,
vielen Dank, nur ich hab nicht den hauch einer Ahnung wo ich das finden und editieren kann :oops: :oops:

Re: Unbekannter SQL-Fehler - 0 GROUP BY t.topic_id

Verfasst: 16.03.2012 15:23
von Michel_61
So,

aus den betreffenden dateien mal die zeilen rausgesucht:

mysqli.php Zeile 182:
$this->sql_error($query);

cms_content.php Zeile 201:
$result = $db->sql_query($sql);

functions_module.php Zeile 529:
$this->module->main($this->p_name, $this->p_mode);

index.php Zeile 58:
$module->load_active();

Hier mal das was laut Installationsanweisung in die Index.php eingepflegt werden soll:
// Begin phpBB Primetime MOD
if ($config['cms_enabled'])
{
include($phpbb_root_path . 'includes/functions_module.' . $phpEx);
include($phpbb_root_path . 'modules/blocks/functions_blocks.' . $phpEx);

// Basic parameter data
$id = request_var('i', '');
$mode = request_var('mode', '');

$user->setup('common');
page_header();

$cms_alter_block = array();
$module = new p_master();

// Instantiate module system and generate list of available modules
$module->list_modules('cms');

// Select the active module
$module->set_active($id, $mode);

// Set custom template path
$tpl_path = $phpbb_root_path . "modules/$module->p_dir/template";
$mtemplate->set_custom_template($tpl_path, $module->p_dir);

// initialize
init_cms_vars();
init_cms_nav();
$blocks = new blocks($module->p_id, $module->p_dir, $module->p_mode);

// Load and execute the relevant module
$module->load_active();

// display blocks
$blocks->display();

$template->assign_var('PAGE_TITLE', $module->get_page_title());

$template->set_filenames(array(
'body' => 'cms/cms_layout.html')
);

if (sizeof($cms_alter_block))
{
foreach ($cms_alter_block as $handle => $row)
{
foreach ($row as $key => $tpl_ary)
{
$template->alter_block_array($handle, $tpl_ary, $key);
}
}
}

unset($mtemplate, $module, $blocks);

page_footer();
}
// End phpBB Primetime MOD
Der rote Text ist die Fehlerzeile in der index.php, vielleicht kommen wir ja so dem Fehler auf die Schliche....

EDIT: Es scheint sich ja jetzt raus zu stellen, das der Fehler ursächlich im Primetime MOD 1.0.4 zu suchen ist. Vielleicht kann der Thread verschoben werden?

Re: Unbekannter SQL-Fehler - 0 GROUP BY t.topic_id

Verfasst: 17.03.2012 21:39
von Michel_61
Sodele dann,

hab die Forensoftware nocheinmal neu installiert und auf das frische und ungeänderte originale phpbb den PrimetimeMod nochmals installiert.

Der Fehler liegt eindeutig an dem MOD, weshalb der Beitrag vielleicht verschoben werden sollte?
Jetzt hab ich nur noch das Problem, das mein Englisch so hundsmiserabel ist das ich dort im forum meine Supportanfrage nicht stellen kann. Probieren werd ichs, sollte das einer verstehen was ich da zurechtschreibe bleibt nur noch zu hoffen das ich es verstehe und umsetzen kann.
Hier hat nicht jemand Primetime 1.0.4 iinstalliert?

Re: Unbekannter SQL-Fehler - 0 GROUP BY t.topic_id

Verfasst: 17.03.2012 22:01
von Miri pt2
Finde bitte in der /modules/content/cms_content.php folgendes:

Code: Alles auswählen

                    // Get topics      
und poste den darauf folgenden Code bis einschliesslich: $result = $db->sql_query($sql);

oder tausche den gegen das hier aus:

Code: Alles auswählen

                    // Get topics
                    $sql = $db->sql_build_query('SELECT_DISTINCT', array(
                        'SELECT'        => 'c.cat_id, c.cat_name, t.topic_id',
                        'FROM'            => array(
                            CATEGORIES_TABLE        => 'c',
                            CATEGORIES_DATA_TABLE    => 'd',
                            TOPICS_TABLE            => 't',
                        ),
                        'WHERE'            => "d.cat_id = c.cat_id
                            AND d.item_id = t.topic_id
                            AND d.module = 'content'
                            AND t.forum_id = $forum_id
                            AND t.topic_tag = '" . $db->sql_escape($topic_tag) . "'" .
                            ((sizeof($cat_ids)) ? ' AND ' . $db->sql_in_set('d.cat_id', $cat_ids) : '') .
                            ((!$s_can_approve) ? ' AND t.topic_approved <> 0' : ''),
                        'GROUP_BY'        => 't.topic_id',
                        'ORDER_BY'        => 't.topic_time DESC')
                    );
                    $result = $db->sql_query($sql); 
Kannst auch deine ganze Datei mittelsPasteBin posten.