I'm developing some kind of web application simillar to forum. I want to show comments under which it belongs to. I currently used bootstrap, php, mysql for this. Here I post my code....

<div class="col-md-7">
                        <div class="col-md-12">
                         <form  action="insert_post.php" method="post">
                            <div class="input-group">
                            <p><b>You Are Posting As : </b></p><h4><span class="label label-default"><?php echo $_SESSION['username'] ?></span></h4>
                            <textarea class="form-control" rows="2" cols="100" name="postcomment"></textarea>
                             <div class="input-group">
                                 <button type="submit" class="btn btn-success btn-sm" name="btn_post">Upload</button>
                                 <button type="reset" class="btn btn-danger btn-sm">Clear</button>
                        <div class="col-md-12">
                        <font size="4"><span class="label label-default">Your Most Recent Posts : </span></font>

                        echo '<div class="container-fluid">';
                        //echo '<table>';
                             $result2= mysqli_query($con,"SELECT * FROM `comment` WHERE post_id='.$post_id.' ORDER BY `comment`.`t_stamp` DESC")or die("User Error : ".mysqli_error());
                            //echo $post_id;
                             echo' <br>
                            <div class="container-fluid" style="border-radius: 10px;">
                                <div class="col-md-12">
                                    <div class="col-md-12" style="background-color:#f0f0f5;">
                                        <font size="3"><b>By :</b> '.$row['user'].'</font>
                                        <font size="3"><p align="left"><b>@ : </b><i>'.$row['t_stamp'].'</i></p></font>
                                    <div class="col-md-12" style="background-color:#e6f2ff;">
                                        <font size="4"><p align="justify">'.$row['description'].'</p></font>
                                <div class="col-md-12">
                                        <form  action="insert_comment.php" method="post">
                                         <input type="hidden" name="post_identify" value="'.$row['post_id'].'">
                                                    <textarea class="form-control" style="width:600px;" placeholder="Type Your Response" name="comment"></textarea>
                                        <div class="input-group">
                                        <button type="submit" class="btn btn-primary btn-xs" name="btn_comment">Response</button>
                                <div class="col-md-12">';
                                  echo '
                                    <div class="col-md-3" style="background-color:#f0f0f5;">
                                     username<font size="2"><b> '.$row2['user'].'</b></font>
                                    <div class="col-md-9" style="background-color:#f0f0f5;">
                                    comment<font size="3">'.$row2['comment'].'</font>
                                    </div>'; }
                        echo '</div>';

The problem is, it's not showing comments under posts which had comments. I checked post and comment tables. There are many records which refering to posts....
So I want your help to identify why my error is occure :)

Edited by සශික: to improve

8 Months
Discussion Span
Last Post by diafol

This is a confusing snippet. We have unknown variables such as $row and $result.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.