Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

2 Stron V   1 2 >  
Reply to this topicStart new topic
> funkcja file()
Modest
post
Post #1





Grupa: Zarejestrowani
Postów: 35
Pomógł: 0
Dołączył: 17.10.2002
Skąd: Your other side

Ostrzeżenie: (0%)
-----


mam funkcje:

$lista=file("data/".$dzial $id.".txt", "r");

plik nazywa sie, powiedzmy test.php
wpisuje adres: test.php?dzial=prod&id=1
funkcja powinna zabrac z pliku data/prod1.txt wszystkie linie i zapisac kazda w $lista[].........

wywala mi blad na te linie komend :/
why?


--------------------
I'm your master
Go to the top of the page
+Quote Post
KaMeLeOn
post
Post #2





Grupa: Zarejestrowani
Postów: 680
Pomógł: 0
Dołączył: 1.10.2002
Skąd: Wrocław

Ostrzeżenie: (0%)
-----


Popatrz na argumenty...
Cytat
array file( string nazwa_pliku [, int użyj_include_path])


--------------------
"Czerp z innych, ale nie kopiuj ich. Bądź sobą." Michel Quoist
Go to the top of the page
+Quote Post
Modest
post
Post #3





Grupa: Zarejestrowani
Postów: 35
Pomógł: 0
Dołączył: 17.10.2002
Skąd: Your other side

Ostrzeżenie: (0%)
-----


niebardzo rozumiem
mozesz mi to pokazac ze wstawionymi odpowiednimi danymi?


--------------------
I'm your master
Go to the top of the page
+Quote Post
KaMeLeOn
post
Post #4





Grupa: Zarejestrowani
Postów: 680
Pomógł: 0
Dołączył: 1.10.2002
Skąd: Wrocław

Ostrzeżenie: (0%)
-----


[php:1:62f8039a9b]<?php
$lista = file("data/".$dzial . $id.".txt");
?>[/php:1:62f8039a9b]


--------------------
"Czerp z innych, ale nie kopiuj ich. Bądź sobą." Michel Quoist
Go to the top of the page
+Quote Post
Modest
post
Post #5





Grupa: Zarejestrowani
Postów: 35
Pomógł: 0
Dołączył: 17.10.2002
Skąd: Your other side

Ostrzeżenie: (0%)
-----


no i nadal blad sad.gif


--------------------
I'm your master
Go to the top of the page
+Quote Post
KaMeLeOn
post
Post #6





Grupa: Zarejestrowani
Postów: 680
Pomógł: 0
Dołączył: 1.10.2002
Skąd: Wrocław

Ostrzeżenie: (0%)
-----


Cytat
no i nadal blad sad.gif

Jaki?


--------------------
"Czerp z innych, ale nie kopiuj ich. Bądź sobą." Michel Quoist
Go to the top of the page
+Quote Post
Modest
post
Post #7





Grupa: Zarejestrowani
Postów: 35
Pomógł: 0
Dołączył: 17.10.2002
Skąd: Your other side

Ostrzeżenie: (0%)
-----


Parse error: parse error in d:wwwwwwlkatest.php on line 33


--------------------
I'm your master
Go to the top of the page
+Quote Post
KaMeLeOn
post
Post #8





Grupa: Zarejestrowani
Postów: 680
Pomógł: 0
Dołączył: 1.10.2002
Skąd: Wrocław

Ostrzeżenie: (0%)
-----


Jeśli to ta linia to nie ma błędu...
Sprawdź nazwę pliku, ale to nie wywołałoby błędu parse...


--------------------
"Czerp z innych, ale nie kopiuj ich. Bądź sobą." Michel Quoist
Go to the top of the page
+Quote Post
Fo
post
Post #9





Grupa: Zarejestrowani
Postów: 401
Pomógł: 0
Dołączył: 18.04.2003
Skąd: Trójmiasto

Ostrzeżenie: (0%)
-----


a moze ma cos nie tak w linijce wyzej ? 32 ?
Go to the top of the page
+Quote Post
Modest
post
Post #10





Grupa: Zarejestrowani
Postów: 35
Pomógł: 0
Dołączył: 17.10.2002
Skąd: Your other side

Ostrzeżenie: (0%)
-----


skrocilem kod
[php:1:7f979bc543]<?php

$lista = file("data/".$dzial.".txt");

echo($lista[2]);

?>[/php:1:7f979bc543]

wpisuje adres test.php?dzial=prod

W pliku data/prod.txt sa rzedy tekstu.....

I nadal blad....


--------------------
I'm your master
Go to the top of the page
+Quote Post
KaMeLeOn
post
Post #11





Grupa: Zarejestrowani
Postów: 680
Pomógł: 0
Dołączył: 1.10.2002
Skąd: Wrocław

Ostrzeżenie: (0%)
-----


Ufff... trzeba było od razu, że przekazujesz w URL'u...register globals
Zamień $dzial na $_GET['dzial']...


--------------------
"Czerp z innych, ale nie kopiuj ich. Bądź sobą." Michel Quoist
Go to the top of the page
+Quote Post
Modest
post
Post #12





Grupa: Zarejestrowani
Postów: 35
Pomógł: 0
Dołączył: 17.10.2002
Skąd: Your other side

Ostrzeżenie: (0%)
-----


super, dzieki

czyli dobre bedzie:

$lista = file("data/".$_GET['dzial'].$_GET['id'].".txt", "r");

?>[/php]


--------------------
I'm your master
Go to the top of the page
+Quote Post
KaMeLeOn
post
Post #13





Grupa: Zarejestrowani
Postów: 680
Pomógł: 0
Dołączył: 1.10.2002
Skąd: Wrocław

Ostrzeżenie: (0%)
-----


Bez "r", to jest tryb używany w funkcji fopen...
[php:1:d5b9db62cb]<?php
$lista = file("data/".$_GET['dzial'].$_GET['id'].".txt");
?>[/php:1:d5b9db62cb]


--------------------
"Czerp z innych, ale nie kopiuj ich. Bądź sobą." Michel Quoist
Go to the top of the page
+Quote Post
Modest
post
Post #14





Grupa: Zarejestrowani
Postów: 35
Pomógł: 0
Dołączył: 17.10.2002
Skąd: Your other side

Ostrzeżenie: (0%)
-----


ale mi dziala z "r"....


--------------------
I'm your master
Go to the top of the page
+Quote Post
KaMeLeOn
post
Post #15





Grupa: Zarejestrowani
Postów: 680
Pomógł: 0
Dołączył: 1.10.2002
Skąd: Wrocław

Ostrzeżenie: (0%)
-----


Cytat
ale mi dziala z "r"....

co questionmark.gif? To jest tu zupełnie nie potrzebne...
php pewnie konwertuje to na opcjonalny int...


--------------------
"Czerp z innych, ale nie kopiuj ich. Bądź sobą." Michel Quoist
Go to the top of the page
+Quote Post
Modest
post
Post #16





Grupa: Zarejestrowani
Postów: 35
Pomógł: 0
Dołączył: 17.10.2002
Skąd: Your other side

Ostrzeżenie: (0%)
-----


hmmm, dziwne
w ksiazce od Heliona byl przyklad z parametrem "r"....
autor sie pomylil?


--------------------
I'm your master
Go to the top of the page
+Quote Post
KaMeLeOn
post
Post #17





Grupa: Zarejestrowani
Postów: 680
Pomógł: 0
Dołączył: 1.10.2002
Skąd: Wrocław

Ostrzeżenie: (0%)
-----


Cytat
w ksiazce od Heliona byl przyklad z parametrem "r"....
autor sie pomylil?

W funkcji file()?
Jeśli tak to życzę autorowi powodzenia... laugh.gif


--------------------
"Czerp z innych, ale nie kopiuj ich. Bądź sobą." Michel Quoist
Go to the top of the page
+Quote Post
Modest
post
Post #18





Grupa: Zarejestrowani
Postów: 35
Pomógł: 0
Dołączył: 17.10.2002
Skąd: Your other side

Ostrzeżenie: (0%)
-----


czyli jestes na bank pewny, ze nie...? smile.gif
Bibliografia: PHP4 - Ćwiczenia praktyczne - Andrzej Kierzkowski


--------------------
I'm your master
Go to the top of the page
+Quote Post
KaMeLeOn
post
Post #19





Grupa: Zarejestrowani
Postów: 680
Pomógł: 0
Dołączył: 1.10.2002
Skąd: Wrocław

Ostrzeżenie: (0%)
-----


Cytat
czyli jestes na bank pewny, ze nie...? smile.gif [...]

Oczywiście, na 100%...


--------------------
"Czerp z innych, ale nie kopiuj ich. Bądź sobą." Michel Quoist
Go to the top of the page
+Quote Post
Modest
post
Post #20





Grupa: Zarejestrowani
Postów: 35
Pomógł: 0
Dołączył: 17.10.2002
Skąd: Your other side

Ostrzeżenie: (0%)
-----


No ok smile.gif
Ale zeby potem nic mi sie nie sypnelo, bo pracuje nad projektem trzeci dzien winksmiley.jpg


--------------------
I'm your master
Go to the top of the page
+Quote Post

2 Stron V   1 2 >
Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 21.08.2025 - 19:32