Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Odczyt danych tablica / obiekt
Malinaa
post
Post #1





Grupa: Zarejestrowani
Postów: 573
Pomógł: 6
Dołączył: 21.07.2008

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


Witam, mam taki kod:

Kod
Array
(
    [data] => Array
        (
            [0] => stdClass Object
                (
                    [id] => 1
                    [header] => Page header
                    [content] => Page content
                )

        )
)


odczytuje dane za pomocą pętli foreach()

  1. <?php if (!empty($data)): $i=1; foreach ($data as $object): foreach ($object as $value): /* Cos nie tak: Invalid argument supplied for foreach() */ ?>
  2. <div class="row">
  3. <div class="col-md-12">
  4. <a href="<?php echo seoUrl($value->header, $value->id); ?>">Link</a>
  5. </div>
  6. </div>
  7. <?php endforeach; endforeach; endif; ?>

Teoretycznie wszystko ok, ale zaglądam do logów i mam błąd: Invalid argument supplied for foreach()!

Jak odczytać dane bez błędu?

Ten post edytował Malinaa 2.01.2021, 19:31:52


--------------------
I welcome you on the Internet >>> Design by Malina
Go to the top of the page
+Quote Post

Posty w temacie


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 Aktualny czas: 21.08.2025 - 19:50