Mikijs Posted April 21, 2008 Report Share Posted April 21, 2008 <? $fh = fopen("/home/user/user.csv", 'r'); while($theData=fgets($fh)){ $count++; echo $count."-> $theData<br>"; } fclose($fh); ?> kapec es nedabunu faila stauru? - staura ir vairak ka 1000 rindinjas un tapec butu jabut.. Link to comment Share on other sites More sharing options...
andrisp Posted April 21, 2008 Report Share Posted April 21, 2008 Varbūt failu nemaz neatrod ? A vispār vari vienkārši ar file() arī ielasīt failu. Link to comment Share on other sites More sharing options...
bubu Posted April 21, 2008 Report Share Posted April 21, 2008 Varbūt tāpēc, ka fails neeksistē? Te diemžēl nav gaišreģu forumiņš... Link to comment Share on other sites More sharing options...
Mikijs Posted April 21, 2008 Author Report Share Posted April 21, 2008 ne nu ka :/ man php fails atrodas C:/var/www/htdocs/users/users.php bet fails atrodas C:/home/user/user.csv fails eksiste bet kad gribu lasit vinjs man tipa iet tikai lidz C:/var/www/htdocs/ Link to comment Share on other sites More sharing options...
andrisp Posted April 21, 2008 Report Share Posted April 21, 2008 Kas tev tur īsti ir - Nix vai Win ? Iekš Win, šādi ceļi nemaz neeksistē: "/home/user/user.csv" Un to vai failu izdevās atvērt, var pārbaudīt, izdrukājot fopen rezultātu. Link to comment Share on other sites More sharing options...
Mikijs Posted April 21, 2008 Author Report Share Posted April 21, 2008 tas ir Linux ir ta ka ja es failu ielieku ieks C:/var/www/htdocs/users/users.csv tad lasa to failu bet man vajag lai vinjs butu C:/home/users/users.csv Link to comment Share on other sites More sharing options...
andrisp Posted April 21, 2008 Report Share Posted April 21, 2008 Uz Linux nav tādu C disku etc. Un man liekas, ka tu pats nezini, kādu tu ceļu gribi. Sākotnējā skriptā ir user direktorija. Tagad tu saki users. Link to comment Share on other sites More sharing options...
Mikijs Posted April 21, 2008 Author Report Share Posted April 21, 2008 da nu pie kajas kac celjs galvenais ka viens ir var/www un otrs ir /home/.. var/ home/ ir blakus - viena <root> direktorija Link to comment Share on other sites More sharing options...
andrisp Posted April 21, 2008 Report Share Posted April 21, 2008 da nu pie kajas Ko tad brīnies, ka nestrādā ? :D Link to comment Share on other sites More sharing options...
Mikijs Posted April 21, 2008 Author Report Share Posted April 21, 2008 mjam :/ ok pienjemsim ka tagad es esmu www.kaja.lv/pirksti.php un mana vajag izdrukaat www.roka.lv/pirksti.csv saturu.. ka to ? Link to comment Share on other sites More sharing options...
Aleksejs Posted April 21, 2008 Report Share Posted April 21, 2008 Absolūtajiem ceļiem nav pie kājas. Relatīvajiem ir daļēji pie kājas. ;) Link to comment Share on other sites More sharing options...
Mikijs Posted April 21, 2008 Author Report Share Posted April 21, 2008 ok velviens qvestions :) - par salidzinasanu <? $fh2 = fopen("http://localhost/users2.csv", 'r'); while($theData2=fgets($fh2)){ $i++; $array[$i]=true; } fclose($fh2); $fh = fopen("http://localhost/users.csv", 'r'); $c=0; while($theData=fgets($fh)){ $count++; if($array[$count]==true) $alive="true"; else $alive="false"; $c=$c+1; if($c==2) {$c=0;$color="#f2f2f2";} else {$color="#fdfdf3";} $theData=str_replace("\"", "", $theData); echo "<tr style='background-color:$color;'> <td>$count</td> <td><strong>$theData</strong></td> <td>$alive</td> </tr>"; } fclose($fh); ?> Tipa salidzina vai faila kontents ir vienads bet tiklidz es izdzesisu kadu no "users2.csv' ierakstiem tad tas un visi nakamie adisies ka FALSE.. ka lai mekle failaa ? piemeram (neeksistejosas funkcijas) $text="test"; if(search_in_file($text, $file)) echo true; else echo false; ka var shadi ? Link to comment Share on other sites More sharing options...
NiTrino Posted April 21, 2008 Report Share Posted April 21, 2008 ielasi faila saturu mainigajaa ar file_get_contents un rocies pa to ar strstr vai preg_match Link to comment Share on other sites More sharing options...
bubu Posted April 21, 2008 Report Share Posted April 21, 2008 Kāpēc tu failus ver caur http:// protokolu no localhost'a? Link to comment Share on other sites More sharing options...
Recommended Posts