Seite 1 von 3

SQL Error in der Portal_Poll.php

Verfasst: 01.03.2006 13:26
von Beychaliban
Huhu :)


Mein Portal funktioniert auf einmal nicht mehr. Gemeldet wird mir folgendes:
Could not query announcements information

DEBUG MODE

SQL Error : 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 ') AND t.topic_time <= 1141215334 AND t.topic_poster

SELECT t.topic_id, t.topic_time, t.topic_title, pt.post_text, u.username, u.user_id, t.topic_replies, pt.bbcode_uid, t.forum_id, t.topic_poster, t.topic_first_post_id, t.topic_status, pt.post_id, p.post_id, p.enable_smilies FROM phpbb_topics AS t, phpbb_users AS u, phpbb_posts_text AS pt, phpbb_posts AS p WHERE t.forum_id IN () AND t.topic_time <= 1141215334 AND t.topic_poster = u.user_id AND t.topic_first_post_id = pt.post_id AND t.topic_first_post_id = p.post_id AND t.topic_status <> 2 ORDER BY t.topic_time DESC

Line : 86
File : portal_poll.php

In der entsprechenden Datei steht rund um Zeile 86 das hier:

Code: Alles auswählen

//
        // query the database
        //
        if(!($result = $db->sql_query($sql)))
        {
                message_die(GENERAL_ERROR, 'Could not query announcements information', '', __LINE__, __FILE__, $sql);
        }
        //
        // fetch all postings
        //

(Zeile 86 ist die ...message_die... usw.)


Geändert habe ich an dieser Datei nichts. Alles, was ich gemacht habe, war, den simply cms MOD einzubauen.
Da werden aber nur die Dateien lang_main.php und common.php geändert.
Ich vermute, es liegt an der letzten?

Da habe ich folgendes geändert:

Laut Anleitung sollte ich das so machen -
##-----[ FIND ]------------------------------------------------------
##

error_reporting (E_ERROR | E_WARNING | E_PARSE); // This will NOT report uninitialized variables
set_magic_quotes_runtime(0); // Disable magic_quotes_runtime

##
##-----[ ADD BEFORE ]------------------------------------------------
##

// Begin simply CMS Mod
// Type in all the cats-ids you want to display in the simply CMS.
// Separate the cat_ids in $cont_cat with an ',' (comma)
// e.g. $cont_cat = "(1, 2, 5, 7)";

$cont_cat = "(1)";

//
// End simply CMS Mod
//

Aussehen tut es jetzt so:

Code: Alles auswählen

if ( !defined('IN_PHPBB') )
{
        die("Hacking attempt");
}

//
// Begin simply CMS Mod
// Type in all the cats-ids you want to display in the simply CMS.
// Separate the cat_ids in $cont_cat with an ',' (comma)
// e.g. $cont_cat = "(1, 2, 5, 7)";

$cont_cat = "(1, 2, 3, 4, 5, 6, 7)";

//
// End simply CMS Mod
//
error_reporting  (E_ERROR | E_WARNING | E_PARSE); // This will NOT report uninitialized variables
set_magic_quotes_runtime(0); // Disable magic_quotes_runtime

// The following code (unsetting globals)
// Thanks to Matt Kavanagh and Stefan Esser for providing feedback as well as patch files

HILFE - Wo stimmt´s nicht???


Danke für Tips -

Bey

Verfasst: 01.03.2006 16:12
von S2B
Gib mal den Code von den Zeilen über dieser message_die()-Zeile...

Verfasst: 01.03.2006 17:39
von Beychaliban
Portal_Poll.php Zeile 60 - 106 :

Code: Alles auswählen

                       FROM
                          ' . TOPICS_TABLE . ' AS t,
                          ' . USERS_TABLE . ' AS u,
                          ' . POSTS_TEXT_TABLE . ' AS pt,
                          ' . POSTS_TABLE . ' AS p
                        WHERE
                          t.forum_id IN (' . $forum_sql . ') AND
                          t.topic_time <= ' . time() . ' AND
                          t.topic_poster = u.user_id AND
                          t.topic_first_post_id = pt.post_id AND
                          t.topic_first_post_id = p.post_id AND
                          t.topic_status <> 2
                        ORDER BY
                          t.topic_time DESC';
        if ($number_of_posts != 0)
        {
                $sql .= '
                        LIMIT
                          0,' . $number_of_posts;
        }
        //
        // query the database
        //
        if(!($result = $db->sql_query($sql)))
        {
                message_die(GENERAL_ERROR, 'Could not query announcements information', '', __LINE__, __FILE__, $sql);
        }
        //
        // fetch all postings
        //
        $posts = array();
        if ($row = $db->sql_fetchrow($result))
        {
                $i = 0;
                do
                {
                        $posts[$i]['bbcode_uid'] = $row['bbcode_uid'];
                        $posts[$i]['enable_smilies'] = $row['enable_smilies'];
                        $posts[$i]['post_text'] = $row['post_text'];
                        $posts[$i]['topic_id'] = $row['topic_id'];
                        $posts[$i]['topic_replies'] = $row['topic_replies'];
                        $posts[$i]['topic_time'] = create_date($board_config['default_dateformat'], $row['topic_time'], $board_config['board_timezone']);
                        $posts[$i]['topic_title'] = $row['topic_title'];
                        $posts[$i]['user_id'] = $row['user_id'];
                        $posts[$i]['username'] = $row['username'];

Verfasst: 02.03.2006 19:58
von S2B
Such mal in der Datei nach der Stelle, an der $forum_sql definiert wird.

Verfasst: 03.03.2006 08:02
von Beychaliban
Das gibts zwei mal, einmal steht schon in dem oben geposteten Code (7. Zeile von oben), und einmal hier:

Code: Alles auswählen

} // phpbb_fetch_posts

function phpbb_fetch_poll($forum_sql)
{
global $db;

$sql = 'SELECT
t.*,
vd.*
FROM
' . TOPICS_TABLE . ' AS t,
' . VOTE_DESC_TABLE . ' AS vd
WHERE
t.forum_id IN (' . $forum_sql . ') AND
t.topic_status <> 1 AND
t.topic_status <> 2 AND
t.topic_vote = 1 AND
t.topic_id = vd.topic_id
ORDER BY
t.topic_time DESC
LIMIT
0,1';

if (!$query = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Could not query poll information', '', __LINE__, __FILE__, $sql);
}

$result = $db->sql_fetchrow($query);

if ($result)
{
$sql = 'SELECT
*
FROM
' . VOTE_RESULTS_TABLE . '
WHERE
vote_id = ' . $result['vote_id'] . '
ORDER BY
vote_option_id';

if (!$query = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Could not query vote result information', '', __LINE__, __FILE__, $sql);
}

while ($row = $db->sql_fetchrow($query))
{
$result['options'][] = $row;
}
}

return $result;
} // end func phpbb_fetch_poll

Verfasst: 03.03.2006 12:13
von S2B
Naja, da wird die Variable verwendet, aber sie wird da nicht gesetzt...

Verfasst: 03.03.2006 12:47
von Beychaliban
Kannst du bitte mal für php-unsachverständige erklären, was du meinst? - hab nämlich nur ne ungefähre Ahnung von dem, was da überhaupt steht. ;)

Hilfts Dir, wenn du die komplette Datei siehst? Oder brauchst Du eine andere?


*versteht nur Bahnhof*


Bey


/Edit:

kann es sein, dass Du das hier meinst?
-->

Code: Alles auswählen

if ( !defined('IN_PHPBB') )
{
        die("Hacking attempt");
}

error_reporting(E_ERROR | E_WARNING | E_PARSE);
set_magic_quotes_runtime(0);

include_once($phpbb_root_path . 'includes/bbcode.'.$phpEx);


function phpbb_fetch_posts($forum_sql, $number_of_posts, $text_length)
{
        global $db, $board_config;

        $sql = 'SELECT
                          t.topic_id,
                          t.topic_time,
                          t.topic_title,
                          pt.post_text,
                          u.username,
                          u.user_id,
                          t.topic_replies,
                          pt.bbcode_uid,
                          t.forum_id,
                          t.topic_poster,
                          t.topic_first_post_id,
                          t.topic_status,
                          pt.post_id,
                          p.post_id,
                          p.enable_smilies
                        FROM
                          ' . TOPICS_TABLE . ' AS t,
                          ' . USERS_TABLE . ' AS u,
                          ' . POSTS_TEXT_TABLE . ' AS pt,
                          ' . POSTS_TABLE . ' AS p
                        WHERE
                          t.forum_id IN (' . $forum_sql . ') AND
                          t.topic_time <= ' . time() . ' AND
                          t.topic_poster = u.user_id AND
                          t.topic_first_post_id = pt.post_id AND
                          t.topic_first_post_id = p.post_id AND
                          t.topic_status <> 2
                        ORDER BY
                          t.topic_time DESC';
        if ($number_of_posts != 0)
        {
                $sql .= '
                        LIMIT
                          0,' . $number_of_posts;
        }
        //
        // query the database
        //

Verfasst: 03.03.2006 13:51
von S2B
Genau, gib mal die komplette Datei, bitte (KB:datei).

Verfasst: 03.03.2006 15:03
von Beychaliban
Bittesehr :)

portal_poll.txt

Verfasst: 03.03.2006 18:40
von S2B
OK, jetzt habe ich das Problem durchschaut. *g* Such mal bitte die Datei, von der die entsprechende Funktion aufgerufen wurde und gib sie mir.