0

How can i limit the number of characters from my post description on a page.

Please someone should help me, i want to limit the number of characters from my post description. I need a code to limit the number of characters that should appear on a page after a SELECT FROM post.

26th Jun 2018, 12:29 PM
Li2Ekodaf
Li2Ekodaf - avatar
1 Réponse
0
try this SELECT concat(SUBSTRING("this is some text coming from database", 1, 20),'...') AS description from post; Here SUBSTRING(string, start, length) --------------------------------------------------------------------------------------------------------- Much better sql SELECT concat(SUBSTRING(SUBSTRING(description,1,50),1,LENGTH(SUBSTRING(description,1,50)) - LOCATE(' ', REVERSE(SUBSTRING(description,1,50)))+1),'..Read more') FROM post; where 50 is the limit.
26th Jun 2018, 2:17 PM
ᴋᵘⁿᵃˡ
ᴋᵘⁿᵃˡ - avatar