<?php
include ('db.php');
?>
<!DOCTYPE html>
<html style="direction: rtl;">
    <head>
        <meta http-equiv="Content-Type"
              content="text/html; charset=utf-8" />
        <style>
            table {
                width:100%;
            }
            table, th, td {
                border: 1px solid black;
                border-collapse: collapse;
            }
            th, td {
                padding: 15px;
                text-align: right;
            }
            table#t01 tr:nth-child(even) {
                background-color: #eee;
            }
            table#t01 tr:nth-child(odd) {
                background-color: #fff;
            }
            table#t01 th {
                background-color: black;
                color: white;
            }
        </style>
    </head>
    <body>

        <?php
        $sQuery = "SELECT * FROM bus ";
        $userData = R::getAll($sQuery);

        $hQuery = "SELECT * FROM header ";
        $headerData = R::getAll($hQuery);
        ?>

        <!--<h2> show </h2>-->

        <table>
            <tr>
                <?php
                foreach ($headerData as $value) {
                    ?>
                    <th><?php echo $value['a']; ?></th>
                    <th><?php echo $value['b']; ?></th>
                    <th><?php echo $value['c']; ?></th>
                    <th><?php echo $value['d']; ?></th>
                    <th><?php echo $value['e']; ?></th>
                    <th><?php echo $value['f']; ?></th>
                    <?php
                }
                ?>
            </tr>

            <?php
            foreach ($userData as $val) {
                ?>

                <tr>
                    <td><?php echo $val['id']; ?></td>
                    <td><?php echo $val['name']; ?></td>
                    <td><?php echo $val['comment']; ?></td>
                    <td><?php echo $val['period']; ?></td>
                    <td><?php echo $val['code']; ?></td>
                    <td>
                        <a style="color: red;" href="del.php?id=<?php echo $val['id']; ?>" >del</a>
                    </td>
                </tr>


                <?php
            }
            ?>

        </table>
        <br>


    </body>
</html>
