[gelöst] SQL Error : 1054 Unknown column

Probleme bei der regulären Arbeiten mit phpBB, Fragen zu Vorgehensweisen oder Funktionsweise sowie sonstige Fragen zu phpBB im Allgemeinen.
Forumsregeln
phpBB 2.0 hat das Ende seiner Lebenszeit überschritten
phpBB 2.0 wird nicht mehr aktiv unterstützt. Insbesondere werden - auch bei Sicherheitslücken - keine Patches mehr bereitgestellt. Der Einsatz von phpBB 2.0 erfolgt daher auf eigene Gefahr. Wir empfehlen einen Umstieg auf phpBB 3.1, welches aktiv weiterentwickelt wird und für welches regelmäßig Updates zur Verfügung gestellt werden.
Antworten
Benutzeravatar
Morpheus-LB
Mitglied
Beiträge: 148
Registriert: 10.04.2005 20:53
Wohnort: Köln-Bonner-Raum
Kontaktdaten:

[gelöst] SQL Error : 1054 Unknown column

Beitrag von Morpheus-LB »

Hallo zusammen.

Nach aufspielen eines Backups, bekomme ich nun immer folgenden Fehler-Meldung, wenn ich auf "Letzte Themen" gehe:

Code: Alles auswählen

Allgemeiner Fehler
 
could not obtain main information.

DEBUG MODE

SQL Error : 1054 Unknown column 't.topic_first_post_id' in 'on clause'

SELECT t.*, p.poster_id, p.post_username AS last_poster_name, p.post_id, p.post_time, f.forum_name, f.forum_id, u.username AS last_poster, u.user_id AS last_poster_id, u2.username AS first_poster, u2.user_id AS first_poster_id, p2.post_username AS first_poster_name FROM phpbb_topics t, phpbb_posts p LEFT OUTER JOIN phpbb_posts p2 ON p2.post_id = t.topic_first_post_id LEFT OUTER JOIN phpbb_forums f ON p.forum_id = f.forum_id LEFT OUTER JOIN phpbb_users u ON p.poster_id = u.user_id LEFT OUTER JOIN phpbb_users u2 ON u2.user_id = t.topic_poster WHERE t.forum_id NOT IN ('start') AND p.post_id = t.topic_last_post_id AND UNIX_TIMESTAMP(NOW()) - p.post_time < 86400 ORDER BY t.topic_last_post_id DESC LIMIT 0, 25

Line : 127
File : recent.php

kann mir hier jemand weiter helfen ??

Besten Dank vorab
Zuletzt geändert von Morpheus-LB am 01.05.2011 19:25, insgesamt 1-mal geändert.
Besucht doch mal die Laberbox
Benutzeravatar
Mahony
Ehemaliges Teammitglied
Beiträge: 12178
Registriert: 17.11.2005 22:33
Wohnort: Ostfildern Kemnat
Kontaktdaten:

Re: SQL Error : 1054 Unknown column 't.topic_first_post_id'

Beitrag von Mahony »

Hallo
Hier die Lösung für dein Problem.

Code: Alles auswählen

#
#-----[ OPEN ]------------------------------------------------ 
#

recent.php

#
#-----[ FIND ]------------------------------------------------ 
#

	        FROM ". TOPICS_TABLE ." t, ". POSTS_TABLE ." p

# 
#-----[ REPLACE WITH ]---------------------------------------- 
#

	        FROM (". TOPICS_TABLE ." t, ". POSTS_TABLE ." p)
Grüße: Mahony
Taekwondo in Berlin
Wer fragt, ist ein Narr für fünf Minuten, wer nicht fragt, ist ein Narr für immer.
Benutzeravatar
Morpheus-LB
Mitglied
Beiträge: 148
Registriert: 10.04.2005 20:53
Wohnort: Köln-Bonner-Raum
Kontaktdaten:

Re: SQL Error : 1054 Unknown column 't.topic_first_post_id'

Beitrag von Morpheus-LB »

Hallo Mahony.

Sorry...das hat aber leider nichts gebracht...
Der Fehler besteht immer noch...hatte ich erwähnt, daß es ein Mod ist ?
Wenn nicht...sorry :oops:
Besucht doch mal die Laberbox
Benutzeravatar
Mahony
Ehemaliges Teammitglied
Beiträge: 12178
Registriert: 17.11.2005 22:33
Wohnort: Ostfildern Kemnat
Kontaktdaten:

Re: SQL Error : 1054 Unknown column 't.topic_first_post_id'

Beitrag von Mahony »

Hallo
Morpheus-LB hat geschrieben:Sorry...das hat aber leider nichts gebracht...
Der Fehler besteht immer noch...
Doch, das ist genau die Lösung für dein Problem. Am besten, du zeigst uns mal deine recent.php im Pastebin
Morpheus-LB hat geschrieben:...hatte ich erwähnt, daß es ein Mod ist ?
Nein, aber das ist für die Lösung des Problems, in diesem Fall, auch nicht relevant.

Erklärung:
Auf deinem Server wurde eine neue MYSQL-Version (Version 5) installiert.

Hier mal eine kleine Hilfe dazu
However, the precedence of the comma operator is less than of INNER JOIN, CROSS JOIN, LEFT JOIN, and so on. If you mix comma joins with the other join types when there is a join condition, an error of the form Unknown column 'col_name' in 'on clause' may occur. Information about dealing with this problem is given later in this section.
und das hier
#

Previously, the comma operator (,) and JOIN both had the same precedence, so the join expression t1, t2 JOIN t3 was interpreted as ((t1, t2) JOIN t3). Now JOIN has higher precedence, so the expression is interpreted as (t1, (t2 JOIN t3)). This change affects statements that use an ON clause, because that clause can refer only to columns in the operands of the join, and the change in precedence changes interpretation of what those operands are.

Example:

CREATE TABLE t1 (i1 INT, j1 INT);
CREATE TABLE t2 (i2 INT, j2 INT);
CREATE TABLE t3 (i3 INT, j3 INT);
INSERT INTO t1 VALUES(1,1);
INSERT INTO t2 VALUES(1,1);
INSERT INTO t3 VALUES(1,1);
SELECT * FROM t1, t2 JOIN t3 ON (t1.i1 = t3.i3);

Previously, the SELECT was legal due to the implicit grouping of t1,t2 as (t1,t2). Now the JOIN takes precedence, so the operands for the ON clause are t2 and t3. Because t1.i1 is not a column in either of the operands, the result is an Unknown column 't1.i1' in 'on clause' error. To allow the join to be processed, group the first two tables explicitly with parentheses so that the operands for the ON clause are (t1,t2) and t3:

SELECT * FROM (t1, t2) JOIN t3 ON (t1.i1 = t3.i3);

Alternatively, avoid the use of the comma operator and use JOIN instead:

SELECT * FROM t1 JOIN t2 JOIN t3 ON (t1.i1 = t3.i3);

This change also applies to statements that mix the comma operator with INNER JOIN, CROSS JOIN, LEFT JOIN, and RIGHT JOIN, all of which now have higher precedence than the comma operator.
Quelle




Grüße: Mahony
Taekwondo in Berlin
Wer fragt, ist ein Narr für fünf Minuten, wer nicht fragt, ist ein Narr für immer.
Benutzeravatar
Morpheus-LB
Mitglied
Beiträge: 148
Registriert: 10.04.2005 20:53
Wohnort: Köln-Bonner-Raum
Kontaktdaten:

Re: SQL Error : 1054 Unknown column 't.topic_first_post_id'

Beitrag von Morpheus-LB »

habe die recent.php unter gleichen Namen dort hochgeladen
Besucht doch mal die Laberbox
Benutzeravatar
Mahony
Ehemaliges Teammitglied
Beiträge: 12178
Registriert: 17.11.2005 22:33
Wohnort: Ostfildern Kemnat
Kontaktdaten:

Re: SQL Error : 1054 Unknown column 't.topic_first_post_id'

Beitrag von Mahony »

Hallo
Suche

Code: Alles auswählen

$where_forums = ( $special_forums == '0' ) ? 't.forum_id NOT IN ('. $except_forums .')' : 't.forum_id NOT IN ('. $except_forums .') AND t.forum_id IN ('. $forum_ids .')';
$sql_start = "SELECT t.*, p.poster_id, p.post_username AS last_poster_name, p.post_id, p.post_time, f.forum_name, f.forum_id, u.username AS last_poster, u.user_id AS last_poster_id, u2.username AS first_poster, u2.user_id AS first_poster_id, p2.post_username AS first_poster_name
            FROM ". TOPICS_TABLE ." t, ". POSTS_TABLE ." p
        LEFT OUTER JOIN ". POSTS_TABLE ." p2 ON p2.post_id = t.topic_first_post_id
        LEFT OUTER JOIN ". FORUMS_TABLE ." f ON p.forum_id = f.forum_id
        LEFT OUTER JOIN ". USERS_TABLE ." u ON p.poster_id = u.user_id
        LEFT OUTER JOIN ". USERS_TABLE ." u2 ON u2.user_id = t.topic_poster
            WHERE $where_forums AND p.post_id = t.topic_last_post_id AND ";
$sql_end = "  ORDER BY t.topic_last_post_id DESC LIMIT $start, $topic_limit
Ersetze mit

Code: Alles auswählen

$where_forums = ( $special_forums == '0' ) ? 't.forum_id NOT IN ('. $except_forums .')' : 't.forum_id NOT IN ('. $except_forums .') AND t.forum_id IN ('. $forum_ids .')';
$sql_start = "SELECT t.*, p.poster_id, p.post_username AS last_poster_name, p.post_id, p.post_time, f.forum_name, f.forum_id, u.username AS last_poster, u.user_id AS last_poster_id, u2.username AS first_poster, u2.user_id AS first_poster_id, p2.post_username AS first_poster_name
            FROM (". TOPICS_TABLE ." t, ". POSTS_TABLE ." p)
        LEFT OUTER JOIN ". POSTS_TABLE ." p2 ON p2.post_id = t.topic_first_post_id
        LEFT OUTER JOIN ". FORUMS_TABLE ." f ON p.forum_id = f.forum_id
        LEFT OUTER JOIN ". USERS_TABLE ." u ON p.poster_id = u.user_id
        LEFT OUTER JOIN ". USERS_TABLE ." u2 ON u2.user_id = t.topic_poster
            WHERE $where_forums AND p.post_id = t.topic_last_post_id AND ";
$sql_end = "  ORDER BY t.topic_last_post_id DESC LIMIT $start, $topic_limit"; 
Grüße: Mahony
Taekwondo in Berlin
Wer fragt, ist ein Narr für fünf Minuten, wer nicht fragt, ist ein Narr für immer.
Benutzeravatar
Morpheus-LB
Mitglied
Beiträge: 148
Registriert: 10.04.2005 20:53
Wohnort: Köln-Bonner-Raum
Kontaktdaten:

Re: SQL Error : 1054 Unknown column 't.topic_first_post_id'

Beitrag von Morpheus-LB »

Suppi...danke Mahony... :grin:

Das Problem ist gelöst...nochmals Danke.
Besucht doch mal die Laberbox
Antworten

Zurück zu „phpBB 2.0: Administration, Benutzung und Betrieb“