Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6932259
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:40:59+00:00 2026-05-27T11:40:59+00:00

Im having trouble with my Post and Comment to Post section of code. I

  • 0

Im having trouble with my Post and Comment to Post section of code. I am relatively new to coding and I am not even sure if this is even the best way to do this. The code will post, as well as comment correctly, but the problem is that it won’t display correctly. What happens is when it displays it will pull the blab in the correct order as well as the comments, but the comments repeat themselves on upon each post.

So for further clarification it looks like this…

  • Post 1
  • comment 1
  • comment 2
  • comment 3

  • Post 2

  • comment 1
  • comment 2
  • comment 3
  • comment 4

  • Post 3

  • comment 1
  • comment 2
  • comment 3
  • comment 4
  • comment 5

The numbers stand for the ids

Here is my code.

// ------- MEMBER BLABS OUTPUT CONSTRUCTION ---------

$sql_blabs = mysql_query("SELECT id, mem_id, the_blab, blab_date, blab_type, device, fromid FROM blabbing WHERE mem_id='$id' ORDER BY blab_date DESC LIMIT 30");

while($row = mysql_fetch_array($sql_blabs)){

    $blabid = $row["id"];
    $fromid = $row["fromid"];
    $blab_device = $row["device"];

        $sql_comments = mysql_query("SELECT * FROM blab_comments WHERE blab_id='$blabid' ORDER BY id ASC");
        $count_comment = mysql_num_rows($sql_comments);
        if($count_comment > 0){
        while($row2=mysql_fetch_array($sql_comments)){
            $comment_mem_id = $row2['mem_id'];
            $com_blab_id = $row2['blab_id'];
            $comment_txt = $row2['the_comment'];
            $comment_date = $row2['comment_date'];
            $convertedTime = ($myObject -> convert_datetime($comment_date));
            $whenComment = ($myObject -> makeAgo($convertedTime));
            $sql_comment_user = mysql_query("SELECT firstname, lastname FROM myMembers WHERE id='$comment_mem_id' LIMIT 1");
            while($row3 = mysql_fetch_array($sql_comment_user)){
            $firstname = $row3['firstname']; 
            $lastname = $row3['lastname']; 
            $comment_user = $firstname.' '.$lastname;
            }
            $comment_pic = check_pic("members", $comment_mem_id, "40", "profile");
            ///////  Mechanism to Display Real Name Next to Username - real name(username) //////////////////////////
            $DisplayCommentList .='
                <div style="background-color:#e3eaf3; width:auto; height:auto; word-wrap: break-word;">
                <div style="margin-right:10px; margin:8px; width:40px; height:40px; overflow:hidden; display:inline-block;">'.$comment_pic.'</div>
                <div style="float:right; width:390px; margin-bottom:8px; margin-top:3px;">
                    <span class="liteGreyColor textsize9" style="width:auto;">'.$whenComment.' 
                        <a href="profile.php?id=' . $fromid . '"><strong>'.$comment_user.'</strong></a> said via <em>'.$blab_device.'</em>
                    </span><br />'.$comment_txt.'<br />
                </div>
            </div>
            <hr style="margin:0px; clear:both; margin-left:8px;" />';
        }
        }else{
            $DisplayCommentList = "";
        }

    $uid = $row["mem_id"];
    $the_blab = $row["the_blab"];
    $the_blab = ($activeLinkObject -> makeActiveLink($the_blab));
    $blab_date = $row["blab_date"];
    $convertedTime = ($myObject -> convert_datetime($blab_date));
    $whenBlab = ($myObject -> makeAgo($convertedTime));
    $blab_date = $row["blab_date"];
    $blab_type = $row["blab_type"];
    $blab_pic = check_pic("members", $fromid, "60", "profile");
       //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        $usersql = mysql_query("SELECT firstname, lastname FROM myMembers WHERE id='$fromid' LIMIT 1");
        while($row = mysql_fetch_assoc($usersql)){
            $fromuser = $row["firstname"];
            $fromuserLast = $row["lastname"];
            $fromusername = $fromuser . ' ' . $fromuserLast;
            if(isset($_SESSION['idx'])){

                $blabberDisplayList .= '
                    <table style="background-image:url(images/white_title.png); color:#333; border:#F0F0F0 1px solid; border-top: 0px; padding-bottom:10px;" cellpadding="0" cellspacing="0" width="100%">
                        <tr>
                        <td width="18%" valign="top"><div id="blab_pic" style="overflow:hidden; width:60px; margin:10px 0px 10px 10px;">' . $blab_pic . '</div></td>
                        <td width="82%" valign="top" style="line-height:1.5em; padding-top:7px;">
                        <span id="myTable" class="liteGreyColor textsize9">' . $whenBlab . ' <a href="profile.php?id=' . $fromid . '"><strong>' . $fromusername . '</strong></a> said via <em>' . $blab_device . '</em></span><br />
                         ' . $the_blab . '
                        </td>
                        </tr>
                        <tr>
                        <td width="18%" valign="top"></td>
                        <td width="82%" style="line-height:1.5em; padding-right:15px; background-color:#e3eaf3;" valign="top">
                        '.$DisplayCommentList.'
                        <div id="new_comment'.$blabid.'" style="display:none;">

                        </div>
                        <textarea id="Comment'.$blabid.'" style="width:99%; margin-top:8px; margin-left:8px;" rows="1"></textarea><br />
                        <input style="color:#666; float:right; background-color:transparent; border:0px; margin-left:8px; margin-right:8px;" type="submit" value="comment" onclick="javascript:SendComment(\''.$blabid.'\');" />
                        </td>
                        </tr></table>';

}}}
// ------- END MEMBER BLABS OUTPUT CONSTRUCTION ---------
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T11:41:00+00:00Added an answer on May 27, 2026 at 11:41 am

    The answer was to place the comment query into a function. While looping through the blabs, it would subsequently loop through “all” of the comments each time it passed over. I got it going now :). Thanks for the help!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having trouble figuring out the best way to encode the POST parameters to
I'm having trouble identifying a plugin (or perhaps is not even a plugin), but
I'm coding a date class and am having trouble with the post-fix increment (the
I'm having trouble getting my callback function to work in post: I've got this
I'm having trouble updating the DOM when doing an AJAX post using JQuery. This
Related directly to this post , I am having trouble implementing some sound advice
Having trouble here and not quite sure how to do it. I've attempted jQuery
I'm having trouble getting my simple contact form to validate and am not sure
Having trouble grasping this: [AcceptVerbs(HttpVerbs.Post)] public ActionResult Edit(Movie movieToEdit) { var originalMovie = (from
I am having trouble converting this curl to something that I can post with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.