1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Rep Power

    There is one issue with my wall script

    hi guys, i have a wall script. it is working fine but i'm facing one issue that is, 'single post is shown multiple times on user's own wall and one time on his friend wall. for example if A have 5 friends script will show single post 5 times. As it is showing one time on friend wall, this portion is working good but issue is on users own wall.
    here is code:
    $qfu = "SELECT * FROM my_friends WHERE (user_id = '$user_id' OR friend_id = '$user_id') AND status = '1'";

    $fu = mysql_query($qfu) or die(mysql_error());

    $rowfu = mysql_num_rows($fu);

    while($rowf = mysql_fetch_array($fu)){

    $user_id = $rowf['user_id'];
    $friend_id = $rowf['friend_id'];

    $querymsgs = "SELECT * FROM messages where uid_fk = '$friend_id' OR uid_fk = '$user_id' order by msg_id DESC Limit 1";
    $qmsgs = mysql_query($querymsgs) or die(mysql_error());
    $row_msgs = mysql_num_rows($qmsgs);

    while($msgs = mysql_fetch_array($qmsgs)){
    $msg_id = $msgs['msg_id'];
    $orimessage = $msgs['message'];
    $message = tolink(htmlentities($msgs['message']));
    $time = $msgs['created'];
    $privacy = $msgs['privacy'];
    if($privacy=='0'){ $privacy='Only Me';} elseif($privacy=='2'){ $privacy='Public';} else { $privacy='Friends';}
    $fullname=$msgs['fname']." ".$msgs['lname'];


    please help me to get rid off this issue. I'm trying since 2 weeks to solve it but failed to get any good result.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jul 2003
    Rep Power
    1) Please enclose your code in [ PHP ] tags. See the sticky at the top of this forum that says READ THIS BEFORE POSTING. It makes your code much easier to read.

    2) Also you are using the deprecated MySQL extensions. You need to reprogram to use PDO.

    3) It appears to me that this is not all of your code and I don't see how it can work at all.
    There are 10 kinds of people in the world. Those that understand binary and those that don't.

IMN logo majestic logo threadwatch logo seochat tools logo