2
0

learning school, task 4 not working

This commit is contained in:
cwikladaniel
2026-01-13 10:42:20 +01:00
parent 0e3c68542d
commit be93d16a61
4 changed files with 95 additions and 8 deletions

View File

@@ -34,7 +34,7 @@ Implementiere eine Bestellfunktion, die:
## File Handling Aufgaben
### Aufgabe 3: Log-System (TXT)
### Aufgabe 3: Log-System (TXT) X
Entwickle ein mehrstufiges Logging-System:

View File

@@ -5,6 +5,8 @@
// ###########
// geht nicht!
ini_set("display_errors", "on");
// Datei
$file = "produkt.csv";
@@ -13,18 +15,15 @@ if(!file_exists($file)){
// Beende das Skript
}
$fp = @fopen($file, 'r'); // a -> all (read, write ...)
$fp = @fopen($file, 'r');
if(!$fp){
die("Error while opening file!");
}
$header = fgetcsv($fp, 0, ",");
$header = fgetcsv($fp);
fclose($fp);
// READ FILE
$fp = @fopen($file, "W");
// READ FILE <- GEHT NICHT
$yo = print_r($header);
echo "<pre> $yo </pre>";
@@ -38,8 +37,10 @@ while(!feof($fp)){ // solange nicht das Ende der Datei erreicht ist
echo "<p> -------------------------------- </p>";
}
// WRITE TO FILE
fclose($fp);
// WRITE TO FILE <- GEHT
// $fp = @fopen($file, "W");
//$row = [7, "NZXTKeyboard", 120, "Tastatur"];
// file, data (array), seperator
//fputcsv($fp, $row, ",");