savejais Posted April 5, 2007 Report Share Posted April 5, 2007 (edited) Kods man ir šāds: <?php $datubaaze = file("db.txt"); $infa = explode("|", $datubaaze); echo $infa[0] echo $infa[1] ?> Jautājums - kā parādīt visus arrayus manuāli tos neliekot? iekš db.txt glabājas nosaukums un links uz rakstu, piem.: Blabla|blabla.txt katrs raksts glabājas iekš sava TxT faila, man vajag lai no db.txt izvelk nosaukumu un tam pieliek <a> lai nokļūtu uz lapu kur tiek inklūdots txt fails. Edited April 5, 2007 by savejais Link to comment Share on other sites More sharing options...
andrisp Posted April 5, 2007 Report Share Posted April 5, 2007 php.net/foreach Link to comment Share on other sites More sharing options...
cucumber Posted April 5, 2007 Report Share Posted April 5, 2007 (edited) for debug i make this echo "<pre>"; print_r($array);// print_r($_POST); etc Edited April 5, 2007 by cucumber Link to comment Share on other sites More sharing options...
andrisp Posted April 5, 2007 Report Share Posted April 5, 2007 Nu, cucumber, un tikai pasaki, ka shis tavs posts ir sakariigs ? Link to comment Share on other sites More sharing options...
Grey_Wolf Posted April 5, 2007 Report Share Posted April 5, 2007 andrisp --> Izlasot Topika virsrakstu, Es arii gribeeju uzrakstiit ka print_r() ... Link to comment Share on other sites More sharing options...
cucumber Posted April 5, 2007 Report Share Posted April 5, 2007 Sorry, kam negadas neizlasiju pedejo teikumu. Pie tam jautajums skan shadi: "Jautājums - kā parādīt visus arrayus manuāli tos neliekot?" izlasot tikai jautajumu atbilde ir sakariga :) Link to comment Share on other sites More sharing options...
savejais Posted April 5, 2007 Author Report Share Posted April 5, 2007 Hargh, tas ir skaidrs, tad kā parādīt tikai nosaukumu arrayus? Link to comment Share on other sites More sharing options...
Grey_Wolf Posted April 5, 2007 Report Share Posted April 5, 2007 iekš db.txt glabājas nosaukums un links uz rakstu, piem.:Blabla|blabla.txt sadi? bla1 | bla1.txt | bla2 | bla2.txt ... visi vienaa rindaa? vai bla1 | bla1.txt bla2 | bla2.txt katrs atseviskaa? ??? Ja 1 varints tad .... njem katru otro un viss... ja katrs savaa rinda (kas arii buutu logjiski ) sakumaa adali katrtu rindu ar \n .... un peec tam vajadziigo rindinju ar to kodu ko uzrakstiji... nu apmeram taa ;) Link to comment Share on other sites More sharing options...
cucumber Posted April 5, 2007 Report Share Posted April 5, 2007 Varbut tu doma array_keys http://lv.php.net/manual/en/function.array-keys.php? Link to comment Share on other sites More sharing options...
savejais Posted April 5, 2007 Author Report Share Posted April 5, 2007 Hmm, nez. T"atad ir fails db.txt, struktūra: Nosaukums|nosaukums.txt Nosaukums2|nosaukums2.txt Man vajag lai jams izprintē tikai nosaukumus (bez nosaukums.txt) un to nosaukumu uztaisa par linku (<a href="nosaukums.txt">Nosaukums</a>) Link to comment Share on other sites More sharing options...
Val Posted April 5, 2007 Report Share Posted April 5, 2007 par sekām neatbildu <?php $fails = file('db.txt'); foreach ($fails as $z => $rinda) { $x = explode('|', $rinda); echo '<a href="'.$x[1].'">'.$x[0].'</a><br/>'; }; ?> Link to comment Share on other sites More sharing options...
savejais Posted April 6, 2007 Author Report Share Posted April 6, 2007 Paļdis sawlja :D Link to comment Share on other sites More sharing options...
Recommended Posts