KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

Selecting table data to display separate tables #70

Open zenon opened this topic on on Aug 10, 2017 - 6 comments

zenon commented on Aug 10, 2017

Hi,

From the result of the sql statement, the Table 1 is displayed. How to separate the table, like to Table 2 and Table 3? Is this possible?

Appreciate your help.

Thanks.

KoolReport commented on Aug 10, 2017

Simplest way is to read data from store then create your own table. One table for each row of dataStore.

zenon commented on Aug 10, 2017

Could you please show me an example of how to read data from each row?

Thanks.

KoolReport commented on Aug 10, 2017

Here is examples:

<?php
$rows = $this->dataStore("storename")->data();
foreach($rows as $row)
{
    echo $row["name"]." ".$row["item"]." ".$row["price"];
    echo "<br/>";
}
?>
zenon commented on Aug 11, 2017

Ok thank you.

How do I put each row in each table? I get all the rows echoed from the example code above.

Appreciate your help. Thanks.

KoolReport commented on Aug 11, 2017

Should be like this:

<?php
$rows = $this->dataStore("storename")->data();
foreach($rows as $row)
{
?>
    <table>
        <thead>
            <tr>
                <th colspan="2"><?php echo $row["name"];?></th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td><?php echo $row["item"]; ?></td>
                <td><?php echo $row["price"]; ?></td>
            </tr>
        </tbody>
    </table>
<?php
}
?>
zenon commented on Aug 11, 2017

Sorry. I think my question earlier was not that clear.

How to display Table 2, Table 3 and Table 4 (each separate table) from Table 1?

Appreciate your help.

Thanks.

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
help needed

None