How do i echo all array elements in a single line whitout line breaks on every itteration though the array? This is the code i was able to come up with but it prints every element on a new line.
while($row = mysql_fetch_assoc($result))
{
echo '<h3> Some text'. $row['user_name'] . '</h3>';
}
h3
is a block element. You can make it display in line by not using h3
(use span
maybe) or styling it to be inline:
CSS:
h3 {
display: inline;
}
That's because <h3>
, like other <hx>
tags are block level elements, and so will render on their own line. You either use an inline element, like <span>
or set the display property of the <h3>
tag to display: inline in the CSS.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With