0
echo '<br />'.utf8_encode($article["texte_article"]);

I would like to have the text to use a css class "art". $article is a table, and texte_article is the selected column in the database.

echo '<br />''<div class=\"art\">'.utf8_encode($article["texte_article"])</div>;

It was a try but didn't work. Do you know why my syntax doesn't work/where I should put the class "art" ?

1
  • Should not need to escape double quotes. Also looks like single quote issue. Try: echo '<br /><div class="art">'.utf8_encode($article["texte_article"]) . '</div>'; Commented Apr 15, 2015 at 16:19

2 Answers 2

1

You are forgetting to add the end of the div in as a string, and you so it is messing up your php:

echo '<div class="art">'.utf8_encode($article["texte_article"]).'</div>';
Sign up to request clarification or add additional context in comments.

Comments

0

There is an error in string concatenation. try this:

echo "<br /><div class='art'>".utf8_encode($article["texte_article"])."</div>";

2 Comments

This answer seems to be a duplicate of the existing one from four minutes ago before you posted this one.
Except you left the unneeded <br> in :) A <div> is a block element, meaning it pushes all other elements to the next line, like a <br> does

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.