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 linda on 01/11/07 13:55

"J.O. Aho" <user@example.net> wrote in message
news:50hhrhF1fuu8cU1@mid.individual.net...
> 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

Thank you Aho for giving me an example of how to go about it. I'm going to
sit down at the weekend and have a go at this myself. I hope you don't
mind, but if I have any problems (questions), would it be ok if I came back
to you with them?

Best wishes,
Linda

 

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

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