Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> foreach i mysql_*
kicaj
post
Post #1





Grupa: Zarejestrowani
Postów: 1 640
Pomógł: 28
Dołączył: 13.02.2003
Skąd: Międzyrzecz/Poznań

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


  1. <?php
  2. function GetTree( $levels )
  3. {
  4. $levels = explode( '.', $levels );
  5. $trees = array();
  6.  
  7. foreach( $levels as $level )
  8. {
  9. $tree_level = $level;
  10.  
  11. $query = &#092;"SELECT * FROM forum_category WHERE category_level = '\".$tree_level.\"' AND category_cluster='1'\";
  12. $result = mysql_query( $query );
  13. $row = @mysql_fetch_array( $result );
  14.  
  15. if( $result == true )
  16. {
  17. $trees[] = $row['category_name'];
  18. }
  19. else
  20. {
  21. $trees[] = &#092;"nie ma\";
  22. }
  23. }
  24.  
  25. return $trees;
  26. // uzywajac var_export() zawsze zwraca mi tablica z wartosciami \"nie ma\".
  27.  
  28. }
  29. ?>

W czym jest blad ze zawsze $result == false?
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:26