This question already has an answer here:
I'm trying to limit my text export in PHP to only 50 characters only
How could I modify the following statement to allow this?
$list[$key]['goods_attr'] = $rows['goods_attr'];
</div>
This question already has an answer here:
I'm trying to limit my text export in PHP to only 50 characters only
How could I modify the following statement to allow this?
$list[$key]['goods_attr'] = $rows['goods_attr'];
</div>
You should do this in your SQL query if possible.
SELECT LEFT(subject , 50) FROM table
Or you could do it by using substr
like this:
$list[$key]['goods_attr'] = substr($rows['goods_attr'], 0, 50);