<?php $erste_Zeile = TRUE ; $csvdatei = 'a1.csv' ; $tabkopf = array('Schichtbeginn','Schichtende','Personal 1','Personal 2','Personal 3'); ?> <!doctype html> <html lang="de"> <head> <title>SCHICHTEN</title> <style> .table {display: table ; border-left:1px solid #888888; border-top:1px solid #888888;} .tr {display: table-row ;} .td {display: table-cell ; padding:3px; border-right:1px solid #888888; border-bottom:1px solid #888888;} </style> </head> <body> <?php $tabelle = '<div class="table"> <div class="tr">' ; for ($ib = 0; $ib<5; $ib++) { $tabelle .= '<div class="td">'.$tabkopf[$ib].'</div>'; } $tabelle .= '</div> ' ; if (($handle = fopen($csvdatei, 'r')) !== FALSE) { while (($data = fgetcsv($handle,50,';')) !== FALSE){ if ($erste_Zeile == FALSE) { $tabelle .= '<div class="tr">' ; for ($c=0; $c < 5; $c++) { $tabelle .= '<div class="td">'.$data[$c].'</div>' ; } $tabelle .= '</div> ' ; } $erste_Zeile = FALSE ; } fclose($handle); } $tabelle .= '</div>' ; echo $tabelle ; ?> </body> </html>
Dieser Beitrag wurde von Holger_N bearbeitet: 11. Januar 2018 - 23:47