Categories > TinyButStrong general >

PHP Generate table

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: cerede2000
Date: 2010-07-28
Time: 11:54

PHP Generate table

Hello,

I have a problem. Here is my code :

foreach($tab as $arr) {
    echo '<tr>';
    foreach($arr as $ligne) {
        echo '<td>' . $ligne . '</td>';
    }
    echo '</tr>';
}

$tab is result to mysql query as :
Array ( [0] => Array ( [0] => 1 [1] => firms [2] => Id [3] => Name ) [1] => Array ( [0] => 2 [1] => users [2] => Id [3] => LastName ) )

I can't to make this with template.

How make this? Auto generate columns and row with TBS template.

Thank!
By: Skrol29
Date: 2010-07-29
Time: 00:03

Re: PHP Generate table

Hi,

It should be like this:

<tr>
<td>[b1.0;block=tr]</td>
<td>[b1.1]</td>
<td>[b1.2]</td>
<td>[b1.3]</td>
</tr>

In your case, the keys of the arrays that represent the records are 0,1,2,3.