Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Only show one conversation for each user

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #39025
    schart
    Participant

    OK, so it’s difficult to explain but I’m gonna try. Basically, I’m making a messages or conversations page, where you can see your conversations. I get the conversation from the messages, so basically I show every message. What I want to do however, is to only show the latest message of each conversation. Here is how I currently have it:

    	
    $getmsg = mysql_query("SELECT * FROM messages WHERE to_user = '$username' ORDER BY id DESC");
    if (!$getmsg){
    die(mysql_error());
    }
    while ($row = mysql_fetch_assoc($getmsg)){
    $from = $row;
    $content = $row;
    $msgid = $row;
    $seen = $row;
    $shortcontent = substr($content, 0, 60)."...";
    ?>
    notseen" href="/convo/">


    if (strlen($content) < 65){
    echo($content);
    }else{
    echo($shortcontent);
    }
    ?>


    }
    ?>

    I sent two messages to myself, and they both show up on the conversation page, I want it so that only the latest of them show up there, and if someone else gives me a message, their latest show there as well. Understand?

    Thank you.
    – Schart

    #106662
    cworsley4
    Member

    I agree, you need a way to identify which conversation the message is a part of and include a date stamp column so that you can get the latest message.

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘Back End’ is closed to new topics and replies.