View Single Post
  #2  
Old 3rd March 2012, 09:36
artifici artifici is offline
Member
 
Join Date: Jan 2011
P2P
Posts: 9
Default
what are you asking is very simple if you understand just a little bit of html
you will have your table like this
PHP Code:
<table>
    <tr>
        <td>field1</td>
        <td>field2</td>
        <td>field3</td>
    </tr>
    
    <?php
        
for($j 0$j $num_rows$j++)
        {
            echo 
'<tr>';
            for(
$i 0$i 3$i++)
                echo 
'<td>'.$row[$j][$i].'</td>';
            echo 
'</tr>';
        }
    
?>
</table>
in you first row(<tr></tr>) you will have the head of the table
and in the double iteration you will build the row with all the fields(<td>>/td>)
to insert/modify a new field you just add/modify the specific <td></td> in the head and then alter the fors
PHP Code:
<table>
    <tr>
        <td>field1</td>
        <td>field2</td>
        <td>field3</td>
        <td>newfield</td>
    </tr>
    
    <?php
        
for($j 0$j $num_rows$j++) // i a
        
{
            echo 
'<tr>';
            for(
$i 0$i 4$i++)
                echo 
'<td>'.$row[$j][$i].'</td>';
            echo 
'</tr>';
        }
    
?>
</table>
i hope you will understand
Reply With Quote