-1

这是我的 SQL 查询:

$result = mysql_query("
    SELECT t.tid, t.title, t.time, t.authorid, t.photo, f.fuid, f.myuid, u.username as writer 
      FROM topics as t, friends as f, users as u 
     WHERE cid='$cid' 
       AND u.id=t.authorid 
       AND (
               f.fuid=t.authorid AND f.myuid='$myid' 
               OR
               f.myuid=t.authorid AND f.fuid='$myid'
           ) 
  ORDER BY tid DESC 
     LIMIT $start, $perpage
");

仅当朋友发布某些内容时,我才会得到输出,而当我发布时却没有得到任何内容。我的朋友可以查看我的更新,但我自己不能。

4

1 回答 1

0

如果没有更多信息(例如示例数据),我会说:尝试以下操作:

$result = mysql_query("
    SELECT t.tid, t.title, t.time, t.authorid, t.photo, f.fuid, f.myuid, u.username as writer 
      FROM topics as t, friends as f, users as u 
     WHERE cid='$cid' 
       AND u.id=t.authorid 
       AND (
               f.fuid=t.authorid AND f.myuid='$myid' 
               OR
               f.myuid=t.authorid AND f.fuid='$myid'
               OR
               t.autorid='$myid'
           ) 
  ORDER BY tid DESC 
     LIMIT $start, $perpage
");
于 2013-08-25T16:42:32.733 回答