php dinamic table

Discussion in 'PHP' started by Joseph S, Aug 11, 2008.

  1. #1
    Hello

    I have <? echo '$stuff';?> that returns stuff1, stuff 2, stuff3, etc 'till stuff7. What I want it to add them in a table like this:

    <table border=1 cellspacing=0 cellpadding=0>
     <tr>
      <td width=295 colspan=2 valign=top>
    1
      </td>
      <td width=295 colspan=2 rowspan=2 valign=top>
     2
    
      </td>
     </tr>
     <tr>
      <td width=295 colspan=2 valign=top>
     3
      </td>
     </tr>
     <tr>
      <td width=148 valign=top>
    
     4
      </td>
      <td width=148 valign=top>
      5
      </td>
      <td width=148 valign=top>
     6
      </td>
      <td width=148 valign=top>
    7
      </td>
     </tr>
    
    
    </table>
    
    Code (markup):
    I know that there is a way to do this with php count++ but I can`t manage to do it. Is there anyone who could help me out. I want to learn how to do it.

    Thanks in advance! :)
     
    Joseph S, Aug 11, 2008 IP
  2. Vooler

    Vooler Well-Known Member

    Messages:
    1,146
    Likes Received:
    64
    Best Answers:
    4
    Trophy Points:
    150
    #2
    This is actually irregular critaria.
    The cells are not being drawn in a sequencial order, I noticed rowspan for '3'.
    Do you have all the time first 3 enteries in such format.

    Or may be it is all the time same table, if so then

    $array = explode(",",$stuff);

    use <?=$array[0]?> ...1,2,3,4...upto 6.

    regards
     
    Vooler, Aug 11, 2008 IP
  3. keiths

    keiths Peon

    Messages:
    109
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Which part is going to loop? The part that's 4,5,6,7?
     
    keiths, Aug 11, 2008 IP
  4. Joseph S

    Joseph S Well-Known Member

    Messages:
    1,373
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    155
    #4
    Never mind, I have managed to code it myself :)
    Thank you for your help people! It is greatly appreciated!
     
    Joseph S, Aug 24, 2008 IP