How to create Bold data in MySQL database text field?

℡╲_俬逩灬. 提交于 2019-12-24 09:05:08

问题


Is it possible to create bold text in a MySQL database text table field?

We are putting our articles in our database and I want to create bold titles and subtitles. Is this possible? Thanks


回答1:


Markdown

I would advise you to use a markdown-style formatting (PHP/.NET), which would mean bold-text would be stored like this:

**I am bold**

Storing HTML

If you can't use markdown on your project, you can store HTML as well - I would just be very careful about what tags you store. You wouldn't want somebody posting <script/> tags in your database for instance:

<strong>I am bold</strong>

Late-Styling

Or make all values from the title and subtitle fields bold when you print them on your page:

<strong><?php print $row->title; ?></strong>



回答2:


the bolding should be done after getting the fields from the database. the display of the fields should bold it.




回答3:


You can add styling information with some sort of markup. If you're using the data in a web application the obvious choice is to use HTML markup.



来源:https://stackoverflow.com/questions/2037903/how-to-create-bold-data-in-mysql-database-text-field

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!