[thelist] Multiple columns - howto?

Anthony Baratta Anthony at Baratta.com
Tue Feb 18 19:35:01 CST 2003


At 04:56 PM 2/18/2003, CDitty wrote:
>I am trying to spit my mysql output into 3 columns with php, but I cannot
>figure out how.  Can anyone show me some examples on how this is done?
>
>blah                    blah                    blah
>blah                    blah                    blah
>blah                    blah                    blah
>
>Any help is appreciated.

How do you want the data organized?? Alpha left to right? or Alpha down??

The first option is the easiest:

pseudo code alert

colNmbr = 1
colCount = 3
strQuery = "Select Blah Blah Blah"
Execute Query
while we have data
     strRow = db.DataField
     if colNmbr = 1 then
        PrintOut "<tr><td>" . strRow . "</td>"
        colNmbr ++
     else
        PrintOut = "<td>" . strRow . "</td>"

     if colNmbr = colCount
        PrintOut = "<td>" . strRow . "</td></tr>"
        colNmbr = 1
end while


--
Anthony Baratta
President
Keyboard Jockeys

"Conformity is the refuge of the unimaginative."




More information about the thelist mailing list