Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP] Błąd w instrukcji, co jest źle?
axwell
post
Post #1





Grupa: Zarejestrowani
Postów: 143
Pomógł: 1
Dołączył: 14.11.2007

Ostrzeżenie: (10%)
X----


Oto kawałek instrukcji napisanej przezemnie.
Najpierw definiuje zmienne:

  1. <?php
  2. $nazwapliku = 'glosy.php';
  3. $typots = $_GET[ots];
  4. ?>


następnie taki kod:

  1. <?php
  2. if($typots == ron)
  3.  {
  4. $plik = @fopen($nazwapliku);
  5. $ronglosy++;
  6. flock($plik, 2);
  7. fwrite($plik, $ronglosy);
  8. flock($plik, 3);
  9. fclose($plik);
  10.  }
  11. ?>


Wywala mi kilka błędów po kolei:
Warning: flock() expects parameter 1 to be resource, boolean given in C:\Program Files\WebServ\httpd\2\portal\vote.php on line 10

Warning: fwrite(): supplied argument is not a valid stream resource in C:\Program Files\WebServ\httpd\2\portal\vote.php on line 11

Warning: flock() expects parameter 1 to be resource, boolean given in C:\Program Files\WebServ\httpd\2\portal\vote.php on line 12

Warning: fclose(): supplied argument is not a valid stream resource in C:\Program Files\WebServ\httpd\2\portal\vote.php on line 13


Co robię źle?
Powód edycji: Dodaje tag /~strife/
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
maziak
post
Post #2





Grupa: Zarejestrowani
Postów: 155
Pomógł: 17
Dołączył: 9.07.2007

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


Wywal znak @ który masz przed fopen i zobacz jaki błąd, ale juz na oko moge powiedzec ze brakuje drugiego parametru.

http://php.net.pl/manual/pl/function.fopen.php
Tu w manualu jak zjedziesz troszeczke na dól, to masz wypisane mozliwosci.

Pozdrawiam.

edit : oj, nospor byl szybszy (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)

Ten post edytował maziak 2.06.2008, 07:53:55
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Aktualny czas: 3.10.2025 - 08:55