Thanks Jonathan,
I'll have a go with your codes.
Thanks very much
awlad
----- Original Message -----
From: "Jonathan Pitcher" <[EMAIL PROTECTED]>
To: "Awlad Hussain" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, March 03, 2003 4:17 PM
Subject: Re: [PHP] Automatic Table Creation
> Awlad,
>
> I would guess you are trying to create an HTML table to display the
> records.
>
> $Row = The results returned from. mysql_fetch_array().
>
> $Total = count($Row);
>
> $TotalInEachRow = round(($Total/3));
>
> if (($TotalInEachRow * 3) < $Total) {
> $TotalInEachRow ++; // Planning for the Remainder items.
> }
>
> $HTML = "<TABLE>"; // HTML string that holds the table
>
> $ColumnCount = 0; // For knowing the Number of Columns.
>
> for ($C=0; $C<$Total; $C++) {
> if ($ColumnCount == 0) {
> $HTML .= "<TR>";
> }
> $HTML .= "<TD>".$Row[$C]["DatabaseFeildName"]."</TD>":
> $ColumnCount ++;
> if ($ColumnCount == 3) {
> $HTML ."</TR>";
> $ColumnCount = 0;
> }
> }
>
> if ($ColumnCount > 0) {
> for ($C=$ColumnCount; $C<=3; $C++) {
> $HTML .= "<TD> </TD>";
> }
> $HTML .= "</TR>";
> }
>
> $HTML .= "</TABLE>":
>
> That should do it for you. I typed this code directly into the email so
> be forwarned about copy and pasting it.
>
> Hope this helped.
>
> Jonathan Pitcher
>
>
> On Monday, March 3, 2003, at 08:58 AM, Awlad Hussain wrote:
>
> > I have a mysql table containing about 100 record, alphabetically
> > ordered.
> >
> > How would i display them in browser in a 3 columns, doesn't matter how
> > long the rows is as the number of records will grow in the database
> > table.
> >
> > the records should be in alphabetically order, for example:
> >
> > aaa bbba ccca
> > aab bbbb cccb
> > aac bbbc cccc
> > aad bbbd cccd
> >
> > any idea anyone?
> >
> > awlad
> > _______________________________________________________________________
> >
> > Sheridan Phoenix Company
> > The Business Centre Kimpton Road Luton Bedfordshire LU2 0LB
> >
> > Email: [EMAIL PROTECTED]
> > Phone: 01582 522 330
> > Fax: 01582 522 328
> > _______________________________________________________________________
> >
> > This electronic transmission is strictly confidential and intended
> > solely for the addressee. If you are not the intended addressee, you
> > must not disclose, copy or take any action in reliance of this
> > transmission. If you have received this transmission in error it would
> > be helpful if you could notify The Sheridan Phoenix Company Ltd as soon
> > as possible.
> >
> > Any views expressed in this message are those of the individual sender,
> > except where the sender specifically states them to be the views of The
> > Sheridan Phoenix Company Ltd.
> >
> >
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php