SELECT id, judul, IF(CHAR_LENGTH(LEFT(posting, $max_chars+1))>$max_chars, CONCAT(SUBSTRING(posting, 1, $max_chars-INSTR(REVERSE(LEFT(posting, $max_chars)), ' ')), '$readmore'), posting) AS posting FROM tabel_posting LIMIT 10;