Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [mysql_num_rows] 'supplied argument is not a valid..
Mody23
post 27.12.2011, 21:22:25
Post #1





Grupa: Zarejestrowani
Postów: 276
Pomógł: 0
Dołączył: 30.06.2010

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


Witam!

Mam taki kod:

  1. $sql = "SELECT * FROM " . GROUP_COMMUNITY . " WHERE head_user_id = '".$userdata['user_id']."'";
  2. $result = $db->sql_query($sql);
  3. while ($row = $db->sql_fetchrow($result))
  4. {
  5. $avatarek = $row['avatar_url'];
  6. $id_grupki = $row['id'];
  7. $name_group = $row['group_name'];
  8. $title_group = $row['group_title'];
  9.  
  10. $sql = "SELECT * FROM " . USER_GROUP_COMMUNITY . " WHERE group_community_id = $id_grupki";
  11. $result = $db->sql_query($sql);
  12. $ilosc_userow = mysql_num_rows($result);
  13.  
  14. $avatar_grupy = '';
  15. if ( $avatarek != NULL )
  16. {
  17. $avatar_grupy .= '<img src="' . $avatarek . '" class="avatar_grupy" alt="" border="0" />';
  18. }
  19. else
  20. {
  21. $avatar_grupy .= '<img src="http://www.ufs.pl/forum/images/misc/unknown_sg.gif" width="40" height="40" class="avatar_grupy" alt="" border="0" />';
  22. }
  23.  
  24. $template->assign_block_vars('grupy_istnieja.twoje_grupy', array(
  25. 'ILOSC_USEROW' => $ilosc_userow,
  26. 'AVATAR_GRUPY' => $avatar_grupy,
  27. 'NAZWA_GRUPY' => $name_group,
  28. 'OPIS_GRUPY' => $title_group)
  29. );
  30. }


Problem jest z tym kawałkiem:

  1. $ilosc_userow = mysql_num_rows($result);


Jak echuję zapytanie, to otrzymuję taki wynik:

Kod
SELECT * FROM user_group_community WHERE group_community_id = 56
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/michael/public_html/forum/group_community.php on line 79
SELECT * FROM user_group_community WHERE group_community_id =


Czego to jest przyczyna? Tego, że tylko raz pobiera mi $row['id'] questionmark.gif

Ten post edytował Mody23 27.12.2011, 21:23:07
Go to the top of the page
+Quote Post
pmir13
post 27.12.2011, 22:33:05
Post #2





Grupa: Zarejestrowani
Postów: 282
Pomógł: 89
Dołączył: 12.04.2011

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


W środku pętli nadpisujesz sobie zawartość zmiennej $result, którą wykorzystujesz do sprawdzania warunku while.
Go to the top of the page
+Quote Post

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 Wersja Lo-Fi Aktualny czas: 7.07.2025 - 00:57