stfc_boy
08-15-2007, 06:00 PM
Hi Guys,
I have a field in my database named about and I want to limit the amount of characters outputted (to 100)of this, so I thought it would be done like so:
<?php
$query = mysql_query("SELECT * FROM players ORDER BY RAND() LIMIT 1") or die(mysql_error());
$text = substr($about,0,100);
while($row = mysql_fetch_array($query)) {
echo '<h3>'. $row['player_name'] .'</h3>'."\n";
echo '<div class="profile_image"><img src="images_two/odhiambo_delete.jpg" /></div>';
echo '<div class="profile_text">'. $row['text'] .'</div>'."\n";
}
?>
However, that does not seem to work, where am I going wrong?
Thanks
Chris
I have a field in my database named about and I want to limit the amount of characters outputted (to 100)of this, so I thought it would be done like so:
<?php
$query = mysql_query("SELECT * FROM players ORDER BY RAND() LIMIT 1") or die(mysql_error());
$text = substr($about,0,100);
while($row = mysql_fetch_array($query)) {
echo '<h3>'. $row['player_name'] .'</h3>'."\n";
echo '<div class="profile_image"><img src="images_two/odhiambo_delete.jpg" /></div>';
echo '<div class="profile_text">'. $row['text'] .'</div>'."\n";
}
?>
However, that does not seem to work, where am I going wrong?
Thanks
Chris