DIV tag creating new line in php
I am trying to style results from database but when I echo <div> it is
creating new line after each result. How can I force the div not to create
a new line?
.message{
border:2px solid;
background-color:white;
}
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'];
echo"</div>";
}
No comments:
Post a Comment