user_id可以在replies表上找到,也可以在profiles表中找到。配置文件表具有real_name列。

下面,我获得了特定replie的所有article_id。我的问题是如何回显保存在real_name表中的注释者的profiles

我认为这是表现。

$replies = mysql_query("select * from replies where article_id = '$row[id]' order by timestamp desc");

while($reply = mysql_fetch_assoc($replies)) {

I can echo the comments from the replies table, but how do I echo the real_name of each?

}

最佳答案

尝试:

$replies = mysql_query("select * from replies,profiles where article_id = '$row[id]' AND replies.user_id=profiles.id order by timestamp desc");


祝好运 !

10-06 05:39