This question already has an answer here:
- DIV tag creating new line in php 5 answers
I had asked this question but didn't clarify what I wanted. I want the rows from table be displayed inside the div. I just want to break each row inside the div so while the div is the main container with background then the rows should align vertical, without creating another border. just the whole thing inside the div.
.message{
border:2px solid;
background-color:white;
float:left;
}
php
$user = $_SESSION['username'];
$mydb = new mysqli('localhost', 'root', '', '');
$stmt = $mydb->prepare("SELECT * FROM messages where from_user = ? ");
$stmt->bind_param('s', $user);
$stmt->execute();
$result = $stmt->get_result();
while ($row = $result->fetch_assoc()) {
echo"<div class='message'>";
echo $row['to_user']."<br/>";
echo"</div>";
}
</div>