Multiple-row table formatting of results

This is a discussion on Multiple-row table formatting of results within the PHP Language forums, part of the PHP Programming Forums category; Hi all, This is probably a simple one if you know what you're doing, but I could use some ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 11-16-2003
Daniel Ruscoe
 
Posts: n/a
Default Multiple-row table formatting of results

Hi all,

This is probably a simple one if you know what you're doing, but I could
use some code to work from.

I'd like to write a script that will take a single key value from rows
in a MySQL database and place each key value into it's own cell in a
table.

Each row of the table needs to be only five cells across before moving
onto the next row.

How, in PHP, can I create a HTML table that will automatically move to
the next row after five cells are filled?

Many thanks in advance.

- Daniel
Reply With Quote
  #2 (permalink)  
Old 11-16-2003
Michael Fuhr
 
Posts: n/a
Default Re: Multiple-row table formatting of results

Daniel Ruscoe <contact@website.plz> writes:

> I'd like to write a script that will take a single key value from rows
> in a MySQL database and place each key value into it's own cell in a
> table.
>
> Each row of the table needs to be only five cells across before moving
> onto the next row.
>
> How, in PHP, can I create a HTML table that will automatically move to
> the next row after five cells are filled?


Work on the problem incrementally: leave MySQL out of the picture
until you've solved the table problem. The data source is irrelevant.

Maintain a variable that you increment each time you fill a cell.
When the number hits five, it's time to end the current row and
start a new one. Either reset the cell counter each time you start
a new row or use the modulus (%) operator when you check it.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 07:07 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0