Probs bei SQL-Abfrage
Verfasst: 07.11.2003 02:35
Ich habe folgende Situation:
In Forum 8 stehen Topics mit den Namen A, B, C und D.
In Forum 19 stehen Beiträge mit den Namen B und D.
Nun brauche ich eine Abfrage, die mir einen Link generiert für den Fall, dass in Forum 19 der gleiche topic-title vorhanden ist wie in Forum 8. Dazu habe ich folgendes in der viewtopic.php ergänzt:
Funzt aber nicht. Erhalte die Fehlermeldung
A.
In Forum 8 stehen Topics mit den Namen A, B, C und D.
In Forum 19 stehen Beiträge mit den Namen B und D.
Nun brauche ich eine Abfrage, die mir einen Link generiert für den Fall, dass in Forum 19 der gleiche topic-title vorhanden ist wie in Forum 8. Dazu habe ich folgendes in der viewtopic.php ergänzt:
Code: Alles auswählen
if ($forum_id == 8)
{
$sql = "SELECT topic_id, topic_title, forum_id
FROM " . TOPICS_TABLE . "
WHERE topic_title = $topic_title
AND forum_id = '19'
LIMIT 1";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Could not obtain topic information", '', __LINE__, __FILE__, $sql);
}
if ( $row = $db->sql_fetchrow($result) )
{
$linktopic_id = intval($row['topic_id']);
}
if ($linktopic_title != '')
{
$template->assign_vars(array(
'U_PTB' => append_sid("viewtopic.$phpEx?topic_id=" . $linktopic_id . "&start=$start"),
'L_PTB' => $lang['Goto_PTB'] . $topic_title)
);
}
}
Kann mir da jemand helfen?SQL Error : 1054 Unbekanntes Tabellenfeld 'B' in where clause.
SELECT topic_id, topic_title, forum_id FROM phpbb_topics WHERE topic_title = B AND forum_id = '19' LIMIT 1
A.