MySQL — how do I get from the database from column a certain number of characters, but without the tags?
I want to get, for example, 300 characters. This is a preview of the article. To read the entire article, you need to go to the page with it (open it). The problem is that the database can be used text tags. In php I take them off (strip_tags). But it turns out less than 300 characters. As I understand it, you need to remove them when retrieving data. How can I do it? Help to write a query.
Wrong answer: Get more and crop
Correct answer: When you save create in database an additional property already brushed it long.
Kenyatta answered on June 10th 19 at 14:51
The easiest way to query from the database with a stock, clean and trim already in the script.
Adriel51 answered on June 10th 19 at 14:53
Well, you can write a function in SQL that will strip tags, identifying them by the corner brackets. The specific implementation depends on the SQL dialect, well, hardly anyone will take it free to do... though, you can search on the Internet ready. Although, I agree with