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");
祝好运 !