You are here: Re: How to display pulled records in two coloums « All PHP « IT news, forums, messages
Re: How to display pulled records in two coloums

Posted by J.O. Aho on 01/09/07 12:58

linda wrote:
> Could some one point me to a link or explain how to show the pulled records
> from a database in two columns?
>
> I would like to pull the field categories, and display them in two columns
> in a table as follows:
>
>
> TABLE NAME CATEGORIES
>
> CAT_ONE CAT_TWO
> CAT_THREE CAT_FOUR
>
> and so on....


echo "<table><tr><td>Column one</td><td>Column two</td>";
$numbercolumns=2;
$counter=0;
while{$row=mysql_fetch_array($result)) {
$counter++;
if(($counter%$numbercolumns)==0) {
echo "</tr><tr>";
}
echo "<td>".$row['column_name']."</td>";
}
while($counter%$numbercolumns) {
$counter++;
/* In case we don't have the right amount of items to make a full row */
echo "<td>&nbsp;</td>";
}
echo "</tr><td>";


Something like that could work, but I hope you get the idea and make something
more useful.

--

//Aho

 

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

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