Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Datei auslesen und Inhalte zuordnen

Empfohlene Antworten

Veröffentlicht

Guten Tag. Hätte mal wieder ein Problem. Ich habe mir eine csv-Datei mit PHP ausgelesen und lasse mir den Inhalt anzeigen.

Klappt soweit ganz gut, allerdings möchte ich nun, dass er die erste Zeile nicht mit einliest, denn da stehen die Tabellenüberschriften für die Spalten und die brauch ich nicht und zum zweiten hätte ich gerne, dass er die Werte des Array bestimmten Variablen zuordnet.

Also Wert aus Spalte 1 zum Beispiel der Variable $vorname, der aus Spalte 2 der Variable $nachname usw.

Kann mir da mal jemand helfen. Hier das Script:

<?php

$row = 1; // Anzahl der Arrays

$handle = fopen ("nono.csv","r"); // Datei zum Lesen öffnen

while ( ($data = fgetcsv ($handle, 1000, ";")) !== FALSE ) { // Daten werden aus der Datei

// in ein Array $data gelesen

$num = count ($data); // Felder im Array $data

// werden gezählt

print "<p> $num fields in line $row: <br>\n";

$row++; // Anzahl der Arrays wird

// inkrementiert

for ($c=0; $c < $num; $c++) { // FOR-Schleife, um Felder

print $data[$c] . "<br>\n"; // des Arrays auszugeben

}

}

fclose ($handle);

?>

THX

erste Datei ausblenden:

while(...)
{
if($row != 1)
{
}
}[/PHP]

Datenfelder in verschiedene variablen

[PHP]$data_array = split(",",$data);
$vorname = $data_array[0];
..

so in etwa :) ... sollte zumindest der richtige gedankenanstoß für dich sein

jo, danke schön!! :)

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.