Skip to content Skip to sidebar Skip to footer

Append To Current Div Element In A While Loop Only

Good day everyone, I have the following code structure. This code structure loads a page with different post subject and content on it. For each loaded post, a user can leave a com

Solution 1:

try appending an ID to your divs so you can locate them more easily

$id = $row1['id'];
         $subject = $row1['sub'];
         $content = $row1['body'];
         $comments = $row1['comments'];

         echo"
           <div class='content_wrap'>
             <div class='subject' id=subject_$id>$subject</div>
             <div class='content' id=content_$id>$content</div>
             <div class='comment' id=comment_$id>$comments</div>
           </div>
         ";

This should let you append to only the div you want it on.

Post a Comment for "Append To Current Div Element In A While Loop Only"