Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [xml] problem z pobieraniem czesci danych
Forum PHP.pl > Forum > XML, AJAX
terabit
Witam,

mam taki kod:
  1.  
  2. <odds_list>
  3.  
  4. <sport id="1000093178" name="Cricket" main_group_id="1000093178">
  5. <pool id="1000093838" name="The Ashes - Series" main_group_id="1"></pool>
  6. </sport>
  7.  
  8. <sport id="1000093178" name="Golf" main_group_id="2">
  9. <pool id="1000093838" name="The Ashes - Series" main_group_id="2"></pool>
  10. <pool id="1000093838" name="The Ashes - Series" main_group_id="2"></pool>
  11. <pool id="1000093838" name="The Ashes - Series" main_group_id="2"></pool>
  12. <pool id="1000093838" name="The Ashes - Series" main_group_id="2"></pool>
  13. </sport>
  14.  
  15. <sport id="1000093178" name="Pilka" main_group_id="3">
  16. <pool id="1000093838" name="The Ashes - Series" main_group_id="3"></pool>
  17. <pool id="1000093838" name="The Ashes - Series" main_group_id="3"></pool>
  18. <pool id="1000093838" name="The Ashes - Series" main_group_id="3"></pool>
  19. <pool id="1000093838" name="The Ashes - Series" main_group_id="3"></pool>
  20. </sport>
  21.  
  22. </odds_list>
  23.  


i teraz z pobieraniem tytulow, id (pilka, golf, crickiet) w SimpleXML nie ma problemu...

jednak chce najpierw pobrac tytul a poniez pod nim wyswietlic wszystkie wartosci name z pól "pool"

ma to mnie-wiecej tak wygldac:

Cricket:
-The Ashes - Series

Golf:
-The Ashes - Series
-The Ashes - Series
-The Ashes - Series
-The Ashes - Series

itd...


problem w tym ze nie wiem jak mam te elementy pobrac wedlog main_group_id...

pomoze ktos? winksmiley.jpg
skowron-line
xpath pobierasz wszystkie"sport" a poźniej w pętli znów xpath i pobierasz pool z i id takie jak miał sport.
terabit
zaczalem z xpath kombinowac i znow inny problem,
juz zdazylem tutaj zapytac - Temat: xmlxpath nie wczytuje pliku z zewnatrz winksmiley.jpg
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.