You are here: Formatting string to start new line « All PHP « IT news, forums, messages
Formatting string to start new line

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,",");
?>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация