Hallo,
Ich habe eine Frage kann man eine .csv tabelle mit 6 zeilen und ca. 200 in eine .php tabelle einfügen, die dann noch die zeilen automatisch anpasst (alle haben die größe von dem größten wert in der Spalte?.
Hallo,
Ich habe eine Frage kann man eine .csv tabelle mit 6 zeilen und ca. 200 in eine .php tabelle einfügen, die dann noch die zeilen automatisch anpasst (alle haben die größe von dem größten wert in der Spalte?.
also du meinst mittels php in eine html tabelle oder in eine db also sql tabelle? beides ist keine hexerei.
ja so in der art, ich habe eine fertige excel tablle, mit den 6zeilen und 200 spalten, diese tabelle ist als csv gespeichert, und würde die gerne als richtige Tabelle in php einfügen, das sie wieder aussieht, wie eine excel tabelle
ich möchte keine sql tabelle!
Ungefähr in dieser Reihenfolge:
http://de.php.net/manual/de/function.fopen.php
http://de.php.net/manual/de/control-structures.while.php
http://de.php.net/manual/de/function.fgetcsv.php
http://de.php.net/manual/de/control-structures.foreach.php
http://de.php.net/manual/de/function.echo.php
http://de.php.net/manual/de/function.fclose.php
Mhm.. soweit bin ich nach meiner Meinung jetzt schon ;), kann man den noch eine richtige Tabelle im php erstellen, ich habe nich wirklich lust die ca. 1000 werte einzutragen... oder muss ich alle elemente einzeln eintragen?
Wie wär's denn mal mit Grundlagen lernen!!!
Ungetestet
<html>
<body>
<?php
$fp = fopen ("datei.csv", "r");
if ($fp)
{
echo "<table>\n";
while ($data = fgetcsv($fp, 4096, ";"))
{
echo " <tr>\n";
foreach ($data as $value)
echo " <td>$value</td>\n";
echo " </tr>"\n";
}
echo "</table>\n">
fclose ($fp);
}
else
echo "Fehler beim Oeffnen der Datei";
?>
</body>
</html>
Alles anzeigen
Naja, bin ich noch dabei, beschäftige mich erst seit 2tagen mit php, aber naja das wird schon klappen;)