Werte in drei verschiedenen Tabellen ausgeben

CreativPur

Erfahrenes Mitglied
Hi,

ich habe eine Datenbank, wo ich mir bestimmte Werte in drei verschiedenen Tabellen ausgeben möchte..

PHP:
<table class="table table-hover">
        <thead>
            <td width="20%">
                Bewerbung als
            </td>
            <td width="70%">
                Bewerbungstext
            </td>
            <td width="10%" align="right">
                Ändern
            </td>
        </thead>
        <?php
        $sql = "SELECT bw_als, anschreiben_beruf FROM Anschreiben WHERE Bewerber_id = $Bewerber_id";
        foreach ($pdo->query($sql) as $row) {
        ?>
        <tbody>
            <td>
                <strong><?php echo $row['bw_als'] ?></strong>
            </td>
            <td>
                <?php echo $row['anschreiben_beruf'] ?>
            </td>
            <td align="right">
                <form action="anschreiben_aendern.php" method="post">
                    <input type="hidden" class="form-control" name="Anschreiben_id" value="<?php echo $row['Anschreiben_id'] ?>">              
                    <button type="submit" name"anschreiben_aendern" class="btn btn-success glyphicon glyphicon-pencil row-update btn-xs aendern"></button>
                </form>
            </td>
        </tbody>
        <?php } ?>
    </table>
   
    <table class="table table-hover">
        <thead>
            <td width="20%">
                Bewerbung bei der Firma
            </td>
            <td width="70%">
                Bewerbungstext
            </td>
            <td width="10%" align="right">
                Ändern
            </td>
        </thead>
        <?php
        $sql = "SELECT bw_bei, anschreiben_firma FROM Anschreiben WHERE Bewerber_id = $Bewerber_id";
        foreach ($pdo->query($sql) as $row) {
        ?>
        <tbody>
            <td>
                <strong><?php echo $row['bw_bei'] ?></strong>
            </td>
            <td>
                <?php echo $row['anschreiben_firma'] ?>
            </td>
            <td align="right">
                <form action="anschreiben_aendern.php" method="post">
                    <input type="hidden" class="form-control" name="Anschreiben_id" value="<?php echo $row['Anschreiben_id'] ?>">              
                    <button type="submit" name"anschreiben_aendern" class="btn btn-success glyphicon glyphicon-pencil row-update btn-xs aendern"></button>
                </form>
            </td>
        </tbody>
        <?php } ?>
    </table>
   
    <table class="table table-hover">
        <thead>
            <td width="20%">
                Bewerbung Vorlagen
            </td>
            <td width="70%">
                Bewerbungstext
            </td>
            <td width="10%" align="right">
                Ändern
            </td>
        </thead>
        <?php
        $sql = "SELECT bw_bs, anschreiben_beispiel FROM Anschreiben WHERE Bewerber_id = $Bewerber_id";
        foreach ($pdo->query($sql) as $row) {
        ?>
        <tbody>
            <td>
                <strong><?php echo $row['bw_bs'] ?></strong>
            </td>
            <td>
                <?php echo $row['anschreiben_beispiel'] ?>
            </td>
            <td align="right">
                <form action="anschreiben_aendern.php" method="post">
                    <input type="hidden" class="form-control" name="Anschreiben_id" value="<?php echo $row['Anschreiben_id'] ?>">              
                    <button type="submit" name"anschreiben_aendern" class="btn btn-success glyphicon glyphicon-pencil row-update btn-xs aendern"></button>
                </form>
            </td>
        </tbody>
        <?php } ?>
    </table>

Leider werden mir in allen drei Tabellen der Wert als Leerzeilen angezeigt.
Wie kann ich dies unterbinden ?

Bildschirmfoto 2017-11-21 um 11.58.19.png Bildschirmfoto 2017-11-21 um 11.58.45.png
 
Zurück