开发者

How to create Bold data in MySQL database text field?

开发者 https://www.devze.com 2022-12-15 19:59 出处:网络
Is it possible to create bold text in a MySQL databa开发者_如何学Pythonse text table field? We are putting our articles in our database and I want to create bold titles and subtitles.Is this possible

Is it possible to create bold text in a MySQL databa开发者_如何学Pythonse text table field?

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


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>


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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号