|
zeilenumbruch wo keiner hingehört
Hallo!
Kleines (mir unverständliches) Problem!
Ich lese eine Datei ein und schneider Sie mir dann zurecht damit ich das Ergebnis dann ich eine weitere Datei schreiben kann!
Das blöde ist mir wird ein Zeilenumbruch eingefügt wo keiner hingehört!
"Sony Vaio GR214MP";2325,00;"Mobile Intel Pentium III 1GHz 256 MB SDRAM, 20 GB Festplatte 8x DVD/CDRW-Laufwerk...";"Deeplink";"Link zum Bild"
"Sony Vaio GR214MK";2325,00;"Mobile Intel Pentium III 1GHz 256 MB SDRAM, 20 GB Festplatte 8x DVD/CDRW-Laufwerk...";"Deeplink";"Link zum Bild" ist was ich einlese (ohne die Zeilenumbrüche die hier jetzt dargestellt werden).
Damit wirds bearbeitet:
$temp = ereg_replace('"','',$row);
$bestandteil = explode (";", $temp);
$Beschr = ereg_replace (";",",",$bestandteil[2]);
$pos = strpos($bestandteil[0]," "); // liefert die 1te Positione des Leerzeichens
$erstewort = substr($bestandteil[0],0,$pos);
$suchfelder = explode (" ", $bestandteil[0]);
$text = fwrite ($fp, $erstewort."|".$bestandteil[0]."|".$bestandteil[1]."|".$Beschr."|".$bestandteil[3]."|".$bestandteil[4]."|".$suchfelder[0]."|".$suchfelder[1]."|".$suchfelder[2]."|".$suchfelder[3]);
Und so SOLLTE es zum Schluß aussehen und in eine einzelene Zeile in die neue Datei geschrieben werden:
Sony|Sony Vaio GR214MP|2325,00|Mobile Intel Pentium III 1GHz 256 MB SDRAM, 20 GB Festplatte 8x DVD/CDRW-Laufwerk...|Deeplink|Link zum Bild |Sony|Vaio|GR214MP
Es wird mir aber nach dem Link zum Bild ein Zeilenumbruch eingefügt so das die letzten drei Felder in einer neuen Zeile stehen und dannach gehts mit dem nächsten Datensatz direkt weiter.
Sieht so aus:
Sony|Sony Vaio GR214MP|2325,00|Mobile Intel Pentium III 1GHz 256 MB SDRAM, 20 GB Festplatte 8x DVD/CDRW-Laufwerk...|Deeplink|Link zum Bild
|Sony|Vaio|GR214MP|Sony|Sony Vaio GR214MK|2325,00|Mobile Intel Pentium III 1GHz 256 MB SDRAM, 20 GB Festplatte 8x DVD/CDRW-Laufwerk...|Deeplink|Link zum Bild
|Sony|Vaio|GR214MK|...
Was is da falsch???
lg
Flow
__________________
Lesser known Programming Languages #13: SLOBOL
... Although many compilers allow you to take a coffee break while they compile, SLOBOL compilers allow you to travel to Bolivia to pick the coffee. Forty-three programmers are known to have died of boredom sitting at their terminals while waiting for a SLOBOL program to compile. Weary SLOBOL programmers often turn to a related (but infinitely faster) language, COCAINE.
Geändert von Flow09 (26.11.2002 um 14:45 Uhr).
|