justus Posted March 21, 2004 Report Share Posted March 21, 2004 dots txt fails kuraa sarakstiits kautkas shitam liidziigs ............................................................................... kaste;vaks;4555.g58f5 456;95;sviests;muca slon;ugh;8468 ................................................................................ .................................. vajag lai katru rindinju ievieto savaa masiivaa (rindinju daudzums var buut neierobezots) un kas atdaliits ar semikolu par atsevisku masiiva veertiibu, tiku pie shaada risinaajuma: ?php $f_handle=fopen("fails.txt","r"); while($r=fgets($f,4096)){ $dati[$i]=explode(";",trim($r)); unset($dati[$i][sizeof($dati[$i])]); } fclose($f); ?> Link to comment Share on other sites More sharing options...
justus Posted March 21, 2004 Author Report Share Posted March 21, 2004 labojums: $f_handle=fopen("fails.txt","r"); while($r=fgets($f,4096)){ $dati[$i]=explode(";"); unset($dati[$i][sizeof($dati[$i])]); } fclose($f_handle); ?> bet kautkas nestraadaa Link to comment Share on other sites More sharing options...
hu_ha Posted March 21, 2004 Report Share Posted March 21, 2004 kas tas ir? $dati[$i]=explode(";"); explode sintakse ir: $sadaliitais_masiivs=("peec_kura_daliit","ko_daliit"); Link to comment Share on other sites More sharing options...
hu_ha Posted March 21, 2004 Report Share Posted March 21, 2004 nu tu vareetu pastaastit kaadiem noluukiem tev vajag tik daudz masiivus, bet nu var to txt failu nolasiit un attieciigi sadaliit peec \n un peec tam peec tiem semikoliem $f_handle=fopen("fails.txt","r"); while($r=fgets($f,4096)){ $r.=$r; } $n_mas=explode("\\n",$r); foreach($n_mas as $n) { $s_mas=explode(";",$n); } Link to comment Share on other sites More sharing options...
justus Posted March 21, 2004 Author Report Share Posted March 21, 2004 uzstaisiiju skriptu kas no formas nolasa datus piemeeram shaadus: vards uzvards miilaakaa kraasa etc. un saglabaa txt failaa(jo DB nav pieejamas) katra rindinja ir viens ieraksts, tagad meeginu uztaisiit sho ierakstu atteloshanu noformeetaa veidaa varbuut katram ierakstam vajag pielikt kautkaadu ID Link to comment Share on other sites More sharing options...
rnc Posted March 21, 2004 Report Share Posted March 21, 2004 Mans variants: <?php $fails = file('fails.txt'); for ($i=0;$i<=count($fails);$i++) { $masivs[$i] = explode (";",$fails[$i]); } ?> Link to comment Share on other sites More sharing options...
Recommended Posts