2

enter image description here

I am trying to echo out a line break by using <br></br> but can't seem to get it to display a line break.

I tried to use the <br></br> command

<?php
$sql = "SELECT * FROM review;";

$stmt = mysqli_stmt_init($conn);
//Prepare the prepared statement
if (!mysqli_stmt_prepare($stmt, $sql)) {

} else {
     //Bind parameters to the placeholder
     //Run parameters inside database
     mysqli_stmt_execute($stmt);
     $result2 = mysqli_stmt_get_result($stmt);
     $resultCheck2 = mysqli_num_rows($result2);

     while ($row2 = mysqli_fetch_assoc($result2)) {

      echo '<div class="review_post">';

      echo ' <i class="fas fa-quote-left"></i>'.htmlspecialchars($row2['review']).' '.htmlspecialchars($row2['user_uid']).' '.htmlspecialchars($row2['datesubmitted']).'<i class="fas fa-quote-right"></i>';
      echo '<br></br>';
       echo '<br></br>';
        echo '<br></br>';
      echo '</div>';

}

I expected to display all the reviews in separate line but it is all squashed up.

This is the CSS:

div.review_post {
  position: absolute;
  font-size: 3em;
  left: 8em;
  top: 130em;
  line-height: 5em;
  margin-bottom: 20em;
  white-space: nowrap;
}
  • You'll need to view the HTML source generated in the Browser to see what is going on and work back from there. – TimBrownlaw Jun 07 '19 at 11:06
  • 5
    This isn't a line break issue. It's a layout issue mostly likely caused by your html and css – John Conde Jun 07 '19 at 11:07
  • So how would I do this to figure out the problem? Should I include the css code too? –  Jun 07 '19 at 11:08
  • 1
    You only need to use
    and loose the tags. See what that does for you.
    – TimBrownlaw Jun 07 '19 at 11:09
  • 1
    `` doesn't exist. – Cid Jun 07 '19 at 11:10
  • remove all `
    ` and add only one `
    ` after ``
    – M.Hemant Jun 07 '19 at 11:12
  • Please add the resulting HTML. – MThiele Jun 07 '19 at 11:14
  • I thought that I can still use the older version of
    =
    –  Jun 07 '19 at 11:27
  • Please post the CSS for `review_post`. A `
    ` itself is block-level and, without interference from CSS, would render on a new line.
    – waterloomatt Jun 07 '19 at 11:51
  • 1
    The issue is `position: absolute;` and your left/top coordinates. You are positioning each post directly on top of each other. We do not know what your requirements are but removing `position: absolute;`, `left: 8em;`, `top: 130em;`, `margin-bottom: 20em;` would be a good start. You could also try `position: relative;` but I'll leave it up to you to read about those CSS properties. – waterloomatt Jun 07 '19 at 12:15
  • I am not sure what happened to my other comments but I got it to work now but just can't reduce the gap between the comments and even though that it has been asked before, I still find it confusing looking at other codes –  Jun 07 '19 at 12:55
  • I worked it out, it was my margin-bottom that was causing the huge gap... –  Jun 07 '19 at 13:08

0 Answers0