Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [PHP]Pętla w pętli
agataperz
post 13.08.2017, 08:18:16
Post #1





Grupa: Zarejestrowani
Postów: 182
Pomógł: 0
Dołączył: 24.03.2009
Skąd: Hamburg DE

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


Witam,
nigdy nie stosowałam pętli w pętli i niestety nie wiem jak to skonstruować.
Napisałam coś takiego:
  1. <?php
  2. require('../config/serwer.php');
  3. require('../config/simple_html_dom.php');
  4.  
  5. $query_sql = "SELECT * FROM _integracja_esklep where esklep='go.com'";
  6. if(!$result = mysql_query($query_sql, $db_lnk)){
  7. echo('Baza danych: Blad - pobieranie danych ');
  8. }
  9. while($rowe = mysql_fetch_row($result)){
  10. $html = file_get_html($rowe[2]);
  11. foreach($html->find('a') as $element) {
  12. echo $element->href.'<br>'; $sql = "INSERT into _integracja value ('','www.go.com','".$element->href."','".date('Y-m-d H:i:s')."')"; mysql_query($sql); }
  13.  
  14. $sql = "delete from _integracja where link NOT LIKE 'http://www.go.com%' and esklep='www.go.com'";
  15. mysql_query($sql);
  16. }


ale niestety wywala mi błąd
Fatal error: Call to a member function find() on null in /home (...) on line 14

Ten post edytował agataperz 13.08.2017, 08:19:13
Go to the top of the page
+Quote Post
viking
post 13.08.2017, 08:24:12
Post #2





Grupa: Zarejestrowani
Postów: 6 378
Pomógł: 1116
Dołączył: 30.08.2006

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


$html jest puste. Sprawdz co zawiera zmienna $rowe.


--------------------
Go to the top of the page
+Quote Post
agataperz
post 13.08.2017, 08:37:13
Post #3





Grupa: Zarejestrowani
Postów: 182
Pomógł: 0
Dołączył: 24.03.2009
Skąd: Hamburg DE

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


Dziękuję.
Faktycznie nie sprawdziłam dokładnie zapytania smile.gif
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: 12.07.2025 - 19:23