Jag har följande kod (se nedan) och jag skulle vilja få ut självaste inlägget som en användare har skrivit. Men jag behöver hjälp med kodsnutten.
Det som står längst till vänster om bilden är bara rubriken i forumet. Sen är jag lite fundersam varför jag får ut ? istället för å ä ö. I databasen så visar det åäö. Och .php filen är satt som utf-8? Förslag på vad som kan vara fel där?
Kod: Markera allt
<?php
// How Many Topics you want to display?
$topicnumber = 5;
// Change this to your phpBB path
$urlPath = "Forum";
// Database Configuration (Where your phpBB config.php file is located)
include 'Forum/config.php';
$table_topics = $table_prefix. "topics";
$table_forums = $table_prefix. "forums";
$table_posts = $table_prefix. "posts";
$table_users = $table_prefix. "users";
$link = mysql_connect("$dbhost", "$dbuser", "$dbpasswd") or die("Could not connect");
mysql_select_db("$dbname") or die("Could not select database");
$query = "SELECT t.topic_id, t.topic_title, t.topic_last_post_id, t.forum_id, p.post_id, p.poster_id, p.post_time, u.user_id, u.username
FROM $table_topics t, $table_forums f, $table_posts p, $table_users u
WHERE t.topic_id = p.topic_id AND
f.forum_id = t.forum_id AND
t.forum_id != 3 AND
t.forum_id != 5 AND
t.forum_id != 7 AND
t.forum_id != 7 AND
t.forum_id != 8 AND
t.forum_id != 9 AND
t.forum_id != 11 AND
t.forum_id != 12 AND
t.forum_id != 13 AND
t.forum_id != 14 AND
t.forum_id != 16 AND
t.forum_id != 18 AND
t.forum_id != 20 AND
t.forum_id != 21 AND
t.forum_id != 22 AND
t.forum_id != 23 AND
t.forum_id != 26 AND
t.forum_id != 27 AND
t.forum_id != 28 AND
t.forum_id != 29 AND
t.forum_id != 30 AND
t.forum_id != 31 AND
t.forum_id != 34 AND
t.forum_id != 35 AND
t.forum_id != 17 AND
t.forum_id != 38 AND
t.forum_id != 40 AND
t.forum_id != 39 AND
t.forum_id != 37 AND
t.forum_id != 36 AND
t.forum_id != 41 AND
t.forum_id != 43 AND
t.forum_id != 44 AND
t.forum_id != 45 AND
t.forum_id != 46 AND
t.forum_id != 53 AND
t.forum_id != 49 AND
t.forum_id != 50 AND
t.forum_id != 51 AND
t.forum_id != 52 AND
t.forum_id != 55 AND
t.forum_id != 56 AND
t.forum_id != 57 AND
t.forum_id != 47 AND
t.forum_id != 60 AND
t.topic_status <> 2 AND
p.post_id = t.topic_last_post_id AND
p.poster_id = u.user_id
ORDER BY p.post_id DESC LIMIT $topicnumber";
$result = mysql_query($query) or die("Query failed");
print "<table cellpadding='3' cellSpacing='2' height='100%' width='70%'>";
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo "<tr valign='middle'>
<td>
<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\"><font color=\"#CCC\"><h2><b><a href=\"$urlPath/viewtopic.php?f=$row[forum_id]&t=$row[topic_id]&p=$row[post_id]#p$row[post_id]\">" .
$row["topic_title"] . "</a>
</td>
<td>
<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\"><font color=\"#CCC\"><h2><b><a href=\"$urlPath/viewtopic.php?f=$row[forum_id]&t=$row[topic_id]&p=$row[post_id]#p$row[post_id]\">" .
$row["post_text"] . "</a>
</td>
<td>
<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\"><font color=\"#C0C0C0\"> Av: <a href=\"$urlPath/memberlist.php?mode=viewprofile&u=$row[user_id]\">" .
$row["username"] .
"
<td>
<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\"><font color=\"#C0C0C0\">" .
date('Y-M-d H:i', $row["post_time"]) .
"</td>
</tr></font>";
}
print "</table>";
mysql_free_result($result);
mysql_close($link);
?>
Uffee