Reputation: 103
I run a lost and found pet website and am having trouble listing lost pets.
http://alphapets.co.nz/lost/lost.php
I can't figure out how to only display a few amount of words in the description so that all the listings are the same size and the text does not over flow.
The php is below:
// Retrieves data from MySQL
$data2 = mysql_query("SELECT * FROM pets WHERE status LIKE '".
$thisPage."' ORDER BY `pets`.`ID` DESC")
or die(mysql_error()); //Puts it into an array
while($info2 = mysql_fetch_array( $data2 )) {
//Outputs the image and other data
echo "<div id='wrapper4'>
<div id='pet_profile_image'>
<img src=http://alphapets.co.nz/lost/petimages/resized_$info2[date]$info2[photo]
class='mainimage'>
</div>
<div id='pet_description'>
<h2><a href='/download.php?ID=$info2[ID]'>$info2[name]</a> </h2><br />
<b>Location:</b> $info2[town], $info2[city] <br />
<b>Description</b>: $info2[description] <br /><br />
<a href='/download.php?ID=$info2[ID]'>Click here for more</a>
</div>
</div>";
}
Upvotes: 1
Views: 155
Reputation: 46
This might help;
http://www.daniweb.com/web-development/php/threads/131085/how-to-display-part-of-text-from-msql
Upvotes: 1