CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2008
    Posts
    13

    Question table from array

    Hello,

    I have an array and a variable where I count the number of records from that array. How can I build a dynamic table (not a mysql table) starting from this variable?

    For sample:

    if my variable has the value 5 I need it to generate a table with 5+1 rows and 4 colums

    Please advice. Thank you!

  2. #2
    Join Date
    Jun 2005
    Posts
    1,255

    Smile Re: table from array

    Code:
    echo "<table>"
    for ($i_line=0; $i_line < $var + 1; $i_line++) {
       echo "<tr>"
       for ($i_col=0; $i_col < $var - 1; $i_col++) {
          echo "<td>"
          echo "cell ".$i_line.", ".$i_col."."
          echo "</td>"
       }
       echo "</tr>"
    }
    echo "</table>"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured