Reputation: 1
So I am really bad at concatenation Ive been working on it for an hour the best i can get this to do is no errors butit doesnt echo the username for some reason I am pretty sure it has to do with concatenation anyway.
Code:
echo '<span style="color: #"' . $row['color'] . ';"';
echo $row['user'] . ': ' . '</span>' . $row['message'] . '';
echo '</br>';
Basically I am trying to make the username show the color of the the hex in database. But when I do this it doesnt even show the username just the message.
Upvotes: 1
Views: 42
Reputation: 13283
You didn't close the <span>
tag.
You can also just output the entire string and interpolate the values:
echo "<span style=\"color:#{$row['color']}\">{$row['user']}:</span> {$row['message']}<br>";
Upvotes: 1
Reputation: 1612
echo '<span style="color: #' . $row['color'] . ';">'
. $row['user'] . ': </span>' . $row['message']
. '</br>';
Upvotes: 1