Repeating region problem

So I have this repeating region where I am displaying statuses from a database newest → oldest. In this repeating region I want to call a modal when someone wants to comment. Calling this modal works but only for the newest status. In the second/third/fourth etc status it doesn’t work,
here is my code for the repeating region

"SELECT feed_status.sql_id, feed_status.status, feed_status.user_id, feed_status.image_video, feed_status.username, feed_status.date_time, users.user_sql_id, users.fname, users.lname, users.unique_user_id, users.profile_pic FROM feed_status INNER JOIN users ON feed_status.user_id=users.user_sql_id ORDER BY sql_id DESC";

<?php do { ?>
<li class="masonry-item">
<div class="widget widget-article widget-shadow">

<?php if (preg_match("/.(mp4)$/i", $row_feed['image_video']) ) {
   //If there is a match for .mp4 in the database display this for the videos
 echo '
        <div class="widget-header cover player">
        <video controls preload="auto">
	<source src="uploads/'.$row_feed['image_video'].'">
} else if (preg_match("/.(gif|jpg|png)$/i", $row_feed['image_video']) ) {
    //If there is a match for .gif/png/jpg in the database display this for the images
      echo '
               <div class="widget-header cover">
		<a class="inline-block" href="uploads/'.$row_feed['image_video'].'" data-plugin="magnificPopup" data-main-class="mfp-img-mobile">
		<img src="uploads/'.$row_feed['image_video'].'" width="400" height="200">
    //When they click this textarea the modal pops up
     <textarea data-target="#<?php echo $row_feed['sql_id']; ?>" data-toggle="modal" readonly class="form-control" style="resize:none; height:36px;" placeholder="Add a comment....."></textarea>
    <!-- Start Modal Display -->
   <div class="modal fade" id="<?php echo $row_feed['sql_id']; ?>" aria-hidden="true" aria-labelledby="exampleModalTabs" role="dialog" tabindex="-1">
                      <ul class="nav nav-tabs nav-tabs-line" data-plugin="nav-tabs" role="tablist">
                      <li class="active" role="presentation"><a data-toggle="tab" href="#exampleLine1" aria-controls="exampleLine1"
                      <li role="presentation"><a data-toggle="tab" href="#exampleLine2" aria-controls="exampleLine2"
                      <li role="presentation"><a data-toggle="tab" href="#exampleLine3" aria-controls="exampleLine3"
                      <li role="presentation"><a data-toggle="tab" href="#exampleLine4" aria-controls="exampleLine4"
        <div class="tab-pane active" id="exampleLine1" role="tabpanel">
                          <p>Display status here</p>
                        <div class="tab-pane" id="exampleLine2" role="tabpanel">
                          <p>Display comments here</p>
                        <div class="tab-pane" id="exampleLine3" role="tabpanel">
                         <p>Display likes here</p>
                        <div class="tab-pane" id="exampleLine4" role="tabpanel">
                         <p>Display shares here</p>
   <!-- End Modal Display -->
    <?php } while ($row_feed = mysql_fetch_assoc($feed)); ?>

I can’t see where you close the div for the modal fade.

Because “do” always runs at least once, I’m thinking the problem starts with the while.

forgot that closing div tag in here but it’s in the code

Here is a video to show you guys what’s wrong with it

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.