Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Błąd w klasie..., unexpected T_STRING...
lukir
post
Post #1





Grupa: Zarejestrowani
Postów: 86
Pomógł: 0
Dołączył: 6.08.2004
Skąd: Warszawa

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


Mam taki kod, w którym wyświetla się błąd:

Parse error: parse error, unexpected T_STRING, expecting T_FUNCTION in ######## on line 41

i nie mam pojęcia czemu akurat tego się facet czepia.

  1. <?php
  2. //klasa obsługująca operacje związane z katalogiem
  3. class Catalog {
  4. //zmienne klasy
  5. private $db;
  6. private $i;
  7. private $search;
  8. private $result1;
  9. private $result2;
  10. private $categories;
  11.  
  12.  
  13. //operacja wyliczania wszystkich kategorii w katalogu
  14. public function get_categories() {
  15. $this->db = @mysql_connect(MYQL_HOST, MYSQL_USER, MYSQL_PASSWORD) or die(ERROR_MYSQL_CONNECT);
  16. mysql_select_db("sklepmetro");
  17. $this->search = mysql_query("SELECT * FROM `categories` WHERE `category_id` = 1", $this->db);
  18. $this->result1 = mysql_num_rows($this->search);
  19. $this->result2 = mysql_fetch_array($this->search);
  20. $this->categories[0] = $this->result2[1];
  21.  
  22. if($this->result1==0) {
  23. //nie ma żadnej kategorii w bazie
  24. $this->categories=0;
  25. return $this->categories;
  26. } elseif($this->result1==1) {
  27. //jest przynajmniej jedna kategoria w bazie - wyświetlenie
  28. for($this->i=2; $this->result1==1; $this->i++) {
  29. $this->search = mysql_query("SELECT * FROM `categories` WHERE `category_id` = ".$this->i."", $this->db);
  30. $this->result1 = mysql_num_rows($this->search);
  31. $this->result2 = mysql_fetch_array($this->search);
  32. $this->i-=1;
  33. $this->categories[$this->i] = $this->result2[1];
  34. $this->i+=1;
  35. }
  36. }
  37.  
  38. return $this->categories;
  39. }
  40.  
  41. mysql_close($this->db);
  42. }
  43. ?>
Go to the top of the page
+Quote Post

Posty w temacie
- lukir   Błąd w klasie...   23.01.2006, 18:53:55
- - dr_bonzo   1. Wskazuj zawsze w kodzie ktora to linia nr. 41 -...   23.01.2006, 19:01:57
- - Levabul   Chyba nie ten dział. A co do błędu, to już kolega...   23.01.2006, 20:00:18
- - FiDO   Przenosze na php Poczatkujacy.   23.01.2006, 20:39:36
- - lukir   Dzięki.   24.01.2006, 16:35:39


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: 8.10.2025 - 17:47