You have a query floating in space
Code: Select all
"SELECT username FROM `phpbb_users` WHERE user_id='topic_poster'";
If we are following on from my previous post you will need to run that query, assigning it to a variable first:
Code: Select all
$query2 = "SELECT username FROM `phpbb_users` WHERE user_id='topic_poster'";
The first query you ran will return you a few values, one of them will be 'topic_poster', it is this that you will need to pass not the actual name:
Code: Select all
$query1 = "SELECT topic_title, topic_id, topic_poster, FROM_UNIXTIME( topic_time, "%W the %D %M @ %r" ) AS Topic_Date, post_text FROM phpbb_topics RIGHT JOIN phpbb_posts_text ON topic_first_post_id = post_id WHERE forum_id = 1 ORDER BY topic_time DESC";
$result1 = mysql_query($query1, $db) or die ($query1 .': '.mysql_error());
$row1 = mysql_fetch_row($result1);
$query2 = "SELECT username FROM `phpbb_users` WHERE user_id='".$row1['topic_poster']."'";
$result2 = mysql_query($query2, $db) or die ($query2 .': '.mysql_error());
$row1 = mysql_fetch_row($result1);
The code above will return 2 arrays ($row1 & $row2) containing a single row of data. Dump out the contents of these arrays to see what data has been returned. If you need to run this more than once you will have to amend the logic a little, but I'll leave that for you to figure out as you have better understanding of your application
Do you have phpMyAdmin access to your database ? Or command line access ?
Try those queries I sent you on your tables and see if they are ok, you will get better reporting from either options.
I know it's not pretty but that's the price we have to pay until we get sub-selects:
http://www.mysql.com/doc/en/ANSI_diff_Sub-selects.html
Regards,