@netrox the database is not the issue, the browser output is.
The only concern is the final rendering which can be broken by the HTML inserted by the user. For example the user could open a <li>
tag but never close it, which depending on how the page is structured, could potentially break the entire layout that follows. Or another example open a <strong>
tag without closing it, making all the remaining content bold.
So not only allowed tags must be validated, but how exactly do you allow some tags but not the others? Because it is very easy to prevent parsing of all HTML tags using htmlspecialchars()
PHP method, for example, but when it comes to allowing some of the tags you will have to look for other ways. There is the strip_tags()
PHP function which removes (completely delete) non-allowed tags, but then that means altering the user's content in a bad way, preventing the user to post simple code for example (code to share/show, not code to process).
Beside breaking the layout, you must consider XSS attacks, like inserting javascript into the href attribute of a link, which for example could redirect users to another site. See this long list of possible XSS attacks: https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet
As you can see preventing all HTML tags from being interpreted is very easy, but preventing only some of the tags is much more complicated. To understand that, you could take a look at the enormous "HTML Purifier" framework which only purpose is to allow some HTML tags and make sure that the outputted HTML is valid (i.e. won't break the page) and free of XSS attacks.