I use this function substr(tbarticles.articlebody,1,200) as description1 in a query but for some articles I see that the table layout change and page layout also change. It seems that it counts html characters also. Please let me know how can I fix it?
I used also mb_substr but it doesn’t return anything for description1.
As @Rocket says you will need to use php, here is a function taken from a similar question:-
Edit: I suspect the reason your page layout is changing is because substr is breaking your html. What you need to do is return all of
tbarticles.articlebodyand once you have it in a variable in the php (e.g.$result['articlebody']) then use the function below to trim it to the correct length.So something like:-
Hope this helps.