|
Posted by chris on 10/10/40 11:39
I am displaying various lists of names from a database such as;
Mr C Smith, Mrs A Bell etc.
If the list is longer than the width of the page I end up with;
Mr C Smith, Mrs A Bell, Mr J
Black
How can I bring Mr J Black unto a new line automatically. I've included
the code I am using below.
Thanks, Chris
<?php
while ($myrow = mysql_fetch_row($result)) {
if($myrow[3] != "" AND $myrow[4] != "" ) {
$strtitle = $myrow[3]." & ".$myrow[4];
} else {
$strtitle = $myrow[3].$myrow[4];
}
if($strtitle != "") {
$str[] .= " $myrow[1] <b>$strtitle</b>";
} else {
$str[] .= " $myrow[1]";
}
}
echo implode($str,",");
?>
[Back to original message]
|