Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP][MySQL][OOP] Prośba o sprawdzenie metody w klasie, + ewentualnie lepsze rozwiązanie dla funkcji
Ramzaa
post
Post #1





Grupa: Zarejestrowani
Postów: 207
Pomógł: 17
Dołączył: 4.08.2009

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


Funkcja, a w zasadzie metoda, niestety nie wyświetla poprawnie danych z bazy danych mysql. Chodzi o to, że gdy wartość jakiegoś pola z tabeli == 0, to skrypt działa prawidłowo i pokazuje "Brak informacji...", ok, ale gdy wpiszę dla przykładu byle jakie dane, to wtedy skrypt działa jakby widział tam "0" i pokazuje "Brak informacji...".

Aha i jak możecie, to dajcie jakieś lepsze zapisanie tego, bo coś czuję, że da się tak.

  1. if (($this->user['user_realname']==0) && ($this->user['userlocation']==0) && ($this->user['userpage']==0) && ($this->user['userinterests']==0)) {
  2.  
  3. $this->user['displayRealName'] = '<em>Brak informacji...</em>';
  4. $this->user['displayLocation'] = '<em>Brak informacji...</em>';
  5. $this->user['displayPage'] = '<em>Brak informacji...</em>';
  6. $this->user['displayInterests'] = '<em>Brak informacji...</em>';
  7.  
  8. }
  9.  
  10. else {
  11.  
  12. $this->user['displayRealName'] = $this->user['user_realname'] ;
  13. $this->user['displayLocation'] = $this->user['userlocation'];
  14. $this->user['displayPage'] = $this->user['userpage'];
  15. $this->user['displayInterests'] = $this->user['userinterests'];
  16.  
  17. }
  18.  
  19. return $this->user;


Pozdrawiam.
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: 22.08.2025 - 16:08