0
t_user
-----------------------------
 uid | username | full_name  
-----------------------------
1    | dodo     | Dodo Ash
2    | jane     | Jane Shalimar
----------------------------


t_join

-----------------------------
j_id | uid_fk | uid | status
-----------------------------
1    | 1      | 2   | joining
2    | 2      | 1   | joining
-----------------------------

t_message
-----------------------------
msg_id | message   | uid_fk
-----------------------------
1      | hi all    | 1
2      | nice trip | 2
-----------------------------

PHP代码显示基于Join的数据:

$query = mysql_query("SELECT M.msg_id, M.uid_fk, M.message, M.created, U.full_name, U.profile_pic, U.username, U.uid, F.status, F.uid FROM t_haps_wall M, t_users U, t_join_user F WHERE
        M.uid_fk=U.uid AND F.uid=U.uid AND F.status='joining' order by M.msg_id desc ") or die(mysql_error());

我遇到了 PHP SELECT 代码的问题。关键是朋友消息将显示状态“加入”。那么我该如何设置它来获得它呢?

4

1 回答 1

0

使用此查询它将起作用。

 $query = mysql_query("SELECT M.msg_id, M.uid_fk, M.message, M.created, U.full_name, U.profile_pic, U.username, U.uid, F.status, F.uid FROM t_haps_wall M, t_users U, t_join_user F WHERE
    M.uid_fk=U.uid AND F.uid=U.uid AND M.uid_fk = F.uid AND F.status='joining' order by M.msg_id desc ") or die(mysql_error());
于 2012-11-21T06:52:35.960 回答