[SOLVED] Small Problem!
Posted: Fri Jun 18, 2004 8:36 am
I have recently been trying to make a part on my site where uses can view the most recent forum topics just like php developers network does. The only problem is trying to select the topic and the username. Due to my mysql version I am unable to use UNION,
but I am trying to look for another way to bypass this. My code so far is:
The code only seems to show one record with no username next to it. Any help appreciated! 
Joe
Code: Select all
$sql = "SELECT * FROM phpbb_topics ORDER BY topic_id DESC LIMIT 4";
$result = mysql_query($sql) or die("Error!");
while ($row = mysql_fetch_assoc($result))
{
echo "<font face='verdana' size=1>";
$topic = $row['topic_title'];
$ID = $row['topic_id'];
$user = $row['poster_id'];
if (strlen($topic) > 29)
{
$topic = substr($topic, 0, 29);
$topic = $topic."...";
echo "<img src='pics/bullet.gif'> <A href='http://www.site.com/Forums/viewtopic.php?t=$ID'>$topic</A>";
$sql = "SELECT * FROM phpbb_users WHERE user_id = '$user'";
$result = mysql_query($sql) or die("Error!");
$row = mysql_fetch_assoc($result);
$user1 = $row['username'];
echo " By $user1<br>";
}
}Joe