简体   繁体   中英

How to show own posts if privacy is set to friends

Here is my SQL query:

$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
");

I am getting output only when friends post something but not getting anything when I post. My friends are able to view my updates but myself not.

Without more info (sample data, for example), I'd say: try the following:

$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
");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM