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 in the database tags can be used in the text. In php, I remove them (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 write a request.
- 3choose a text with a large margin and remove tags in php. It will be too complicated and cumbersome on MySQL - Mike
- onecan it be easier to create another field and, when adding an article, add a prepared preview to it? then you don’t have to process the text each time and extract 300 characters from it. - Stuf
|
1 answer
Use the "strip_tags" equivalent on MySQL. here is an example .
Next, do a sample of the form:
SELECT LEFT(strip_tags('text here'), 300); But the PHP version sounds better.
|