Seite 1 von 1

Formatierung eines MySQL results

Verfasst: 29.03.2008 13:23
von filth
Hallo zusammen,

ich habe mir ein kleines Tool geschrieben, welches bestimmte Einträge aus einem phpBB Board holt und diese anzeigt:

Code: Alles auswählen

$result = mysql_query("SELECT phpbb_topics.forum_id, phpbb_topics.topic_id, phpbb_posts.topic_id, phpbb_posts.post_id, 
phpbb_posts_text.post_id, phpbb_posts_text.post_subject, phpbb_posts_text.post_text FROM phpbb_topics, phpbb_posts, 
phpbb_posts_text WHERE phpbb_topics.forum_id='6' && phpbb_topics.topic_id=phpbb_posts.topic_id && 
phpbb_posts.post_id=phpbb_posts_text.post_id ORDER BY phpbb_posts_text.post_id DESC") OR die(mysql_error()); 

while($row = mysql_fetch_array($result))
{
   $newsabfrage .= '<tr><td class="style2" align="left" height="30"><strong><font style="font-size:14pt;">' . 

$row["post_subject"] . '</i></td></strong></font></tr><br><br><tr><td class="style2" colspan="2"><font style="font-size:12pt;">' . $row["post_text"] . 
'</font></td></tr><tr><th colspan="2"><hr noshade></th></tr>';
}

mysql_freeresult($result);
mysql_close();

echo $newsabfrage;
echo '</table>';
Ich habe nun das Problem, dass Leerzeilen nicht richtig mitgenommen werden. Dh das Feld $row["post_text"] in der Datenbank hat beispielsweise Leerzeilen - in meiner Ausgabe wird der Text aber durchgehend ohne diese Leerzeilen dargestellt.

Woran liegt das und wie kann man das beheben?

Gruß
Alex

Verfasst: 29.03.2008 13:42
von filth
schon gefunden:

echo nl2br ($newsabfrage);

und alles ist, wie es sein soll :D