By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,952 Members | 1,908 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,952 IT Pros & Developers. It's quick & easy.

Multiple-row table formatting of results

P: n/a
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
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Daniel Ruscoe <co*****@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/
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.