Jump to content

How to structure the contents of variable via ECHO command??


raymond92

Recommended Posts

Hi i dont know whether i've overlooked something but im finding it hard to answer this myself..

 

Background of the problem:

 

Im keeping the contents of a page in a database, so each page would be a template, and the body text will be stored in the database.

 

So if i want to call up the contents for my 'About' page, i would use the php command: "<?php getAboutPosts(); ?>"

 

The code behind that will be:

 

function getAboutPosts() {

$query = mysql_query("SELECT * FROM posts WHERE id = '20' ") or die (mysql_error());

while($subm = mysql_fetch_assoc($query)) {

echo "<h2>" . $subm['Title'] . " by Removed" . "</h2>";

echo $subm['Content'];

}

}

 

My Actual Problem

 

The text does echo fine, but it is completely unstructured, I.E. it isn't paragraphed, i cant include any type of tag like <b> because it doesn't seem to echo them, although when i check PHPMyAdmin it has all the tags saved in with the content?

 

Example:

 

I have this saved in MySQL Database:

 

<h4>We are a professional website and graphic design business in Basildon, Essex, providing online marketing strategies for companies throughout the UK.</h4>

<p><br />

Whether you require a brochure website, blog or a full e-commerce solution, Imagine Design Studio can help. Maybe you have a new business and want to create an online presence or an established business looking to pull your company into the 21st century.</p>

<p>

 

But when it echos, i get this:

 

We are a professional website and graphic design business in Basildon, Essex, providing online marketing strategies for companies throughout the UK.

Whether you require a brochure website, blog or a full e-commerce solution, Imagine Design Studio can help. Maybe you have a new business and want to create an online presence or an established business looking to pull your company into the 21st century.

 

 

 

Things i've tried:

 

Adding a class to the DIV which the echo will go into - This works for colouring etc, but i still need to paragraph the text and use italics occasionally.

 

Please help guys! Thanks in advance

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.