Thanks James. I have some similar code to do that. but where I get stumped is how to display them vertically alphabetical opposed to horizontally. Jim
_____ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of James Keeline Sent: Thursday, July 21, 2005 10:51 AM To: [email protected] Subject: Re: [php-list] Having trouble outputting a sorted array of names to a multicolumn table > I'm sure this has been done before, but I was wondering if anyone could > point me to a sample of code that shows how to display an array in a > multi-column format like so: > > A F K > B G L > C H M > D I N > E J O > > instead of > > A B C D E > F G H I J > K L M N O > > > Thanks, > Jim You could use an HTML table with three columns. The basic structure is: <table> <tr valign=top> <td>first column</td> <td>second column</td> <td>third column</td> </tr> </table> That said, the trick is to figure out how many elements are in your array and then to decide how many columns to display. $n = count($array); $n3 = ceil($n/3); // or try floor() print "<table><tr valign='top'><td>"; foreach($array as $element) { print $element; print (++$row % $n3) ? "" : "</td><td>"; } print "</td></tr></table>"; James _____ James D. Keeline http://www.Keeline.com http://www.Keeline.com/articles http://Stratemeyer.org http://www.Keeline.com/TSCollection http://www.ITeachPHP.com -- Free Computer Classes: Linux, PHP, etc. Summer Semester Begins Jun 20 -- New Classes Start Every Few Weeks. Community email addresses: Post message: [email protected] Subscribe: [EMAIL PROTECTED] Unsubscribe: [EMAIL PROTECTED] List owner: [EMAIL PROTECTED] Shortcut URL to this page: http://groups.yahoo.com/group/php-list SPONSORED LINKS Php <http://groups.yahoo.com/gads?t=ms&k=Php+mysql&w1=Php+mysql&w2=Job+postings& w3=Design&c=3&s=45&.sig=_JI0oLOTHp0L6he7Al0JDA> mysql Job <http://groups.yahoo.com/gads?t=ms&k=Job+postings&w1=Php+mysql&w2=Job+postin gs&w3=Design&c=3&s=45&.sig=-dIpcxcIcoEHfDBwo1ejXg> postings Design <http://groups.yahoo.com/gads?t=ms&k=Design&w1=Php+mysql&w2=Job+postings&w3= Design&c=3&s=45&.sig=QeP5XtGwYVAxO6-IB_xvjg> _____ YAHOO! GROUPS LINKS * Visit your group "php-list <http://groups.yahoo.com/group/php-list> " on the web. * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> * Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service <http://docs.yahoo.com/info/terms/> . _____ [Non-text portions of this message have been removed] Community email addresses: Post message: [email protected] Subscribe: [EMAIL PROTECTED] Unsubscribe: [EMAIL PROTECTED] List owner: [EMAIL PROTECTED] Shortcut URL to this page: http://groups.yahoo.com/group/php-list Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/php-list/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
