Ok, well the simple solution would be to store HTML tags in the database too... not the best way about it if your trying to maintain data neutrality.
There are a few functions that can help you:
nl2br - Inserts HTML line breaks before all newlines in a string
htmlentities - Convert all applicable characters to HTML entities
wordwrap - Wraps a string to a given number of characters
There are a load of other functions that you might like.
Forums and such use BB code among the text to determine formatting. A good reason to use this approach (as opposed to using direct html tags) is that it encapsulates the implementation of the formatting, such that you can change from one formatting method to another (e.g. from html to css) without modifying the data in the database.
To implement BB code, you can use replace functions (with or without regular expressions (regex) for pattern checking). Regex is slower but more precise, while simple string replace functions such as str_replace are faster and should do the trick for basic BB codes...
Here's a simple example:
PHP Code:
$myText = "[b]Hello World[/b] is a piece of text commonly used to welcome a user to their first [i]working application[/i] in a new [u]computer language.[/u]";
$searchArr = array('[b]', '[/b]', '[i]', '[/i]', '[u]', '[/u]');
$replaceArr = array('<b>', '</b>', '<i>', '</i>', '<u>', '</u>');
$myText = str_replace($searchArr, $replaceArr, $myText);