<?php
$sql = "SELECT YEAR(CURRENT_DATE()) - YEAR(praktikum_von),praktikum_von, date_format( praktikum_bis, '%d.%m.%Y' )praktikum_bis, praktikum_als, praktikum_firma, praktikum_ort, praktikum_bemerkung, lebenslauf_praktikum_id
FROM users_lebenslauf_praktikum
WHERE userid = $userid ORDER BY praktikum_von DESC";
$stmt = $pdo->query($sql);
$rows = $stmt->fetchAll(); // erzeuge ein array aus allen Daten
?>
<div style="display:<?php (($stmt->rowCount() = 0) ? 'none' : 'block') ?> ">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Praktikum:</h3>
</div>
<div class="panel-body">
<table class="table table-hover" >
<tr>
<thead>
<td width="7%">von:</td>
<td width="7%">bis:</td>
<td width="20%">Praktikum als:</td>
<td width="15%">Firma/Einrichtung:</td>
<td width="13%">Ort:</td>
<td colspan="4">Bemerkung:</td>
</thead>
<?php
$sql = "SELECT YEAR(CURRENT_DATE()) - YEAR(praktikum_von),praktikum_von, date_format( praktikum_bis, '%d.%m.%Y' )praktikum_bis, userid, praktikum_als, praktikum_firma,
praktikum_ort,praktikum_bemerkung, lebenslauf_praktikum_id
FROM users_lebenslauf_praktikum
WHERE userid = $userid ORDER BY praktikum_von DESC";
foreach ($rows as $row) {
?>
<tbody>
<td><?php echo date('d.m.Y', strtotime($row['praktikum_von'])) ?></td>
<td><?php echo date('d.m.Y', strtotime($row['praktikum_bis'])) ?></td>
<td><?php echo $row['praktikum_als'] ?></td>
<td><?php echo $row['praktikum_firma'] ?></td>
<td><?php echo $row['praktikum_ort'] ?></td>
<td width="30%"><?php echo $row['praktikum_bemerkung'] ?></td>
<td width="5%">
<form action="lebenslauf_praktikum_aendern.php" method="GET">
<input type="hidden" name="lebenslauf_praktikum_id" class="form-control" style="font-size:9px;" value="<?php echo $row['lebenslauf_praktikum_id'] ?>" />
<input type="hidden" name="titel" class="form-control" style="font-size:9px;" value="im Praktikum " />
<button
type="submit" name"lebenslauf_praktikum_aendern" class="btn btn-success glyphicon glyphicon-pencil row-update btn-xs aendern">
</button>
</form>
</td>
<td width="5%">
<form action="#?save=lebenslauf_praktikum_loeschen" method="post">
<input type="hidden" name="lebenslauf_praktikum_id" class="form-control" style="font-size:9px;" value="<?php echo $row['lebenslauf_praktikum_id'] ?>" />
<button name"lebenslauf_praktikum_loeschen" type="submit" class="btn btn-danger glyphicon glyphicon-remove row-remove btn-xs loeschen"></button>
</form>
</td>
</tbody>
<?php } ?>
</tr>
</table>
</div>
</div>
</div>