Reputation: 71
I have $Description field is a long text from MySql database. Following displays the full text but I really want to display only 50 characters instead of full text length.
<?php echo $row['Description'];?>
I have tried several different options but I don't get any results.
I hope someone can guide me through this. Thank you for your time and help.
Sincerely,
Upvotes: 1
Views: 218
Reputation: 133400
You can use a substr
<?php echo substr($row['Description'], 0, 50); ?>
Upvotes: 1
Reputation: 5534
Use substr function:
<?php echo substr($row['Description'], 0, 50);?>
Upvotes: 2