4
[0] => stdClass Object(
  [id] => 1 [name] => Yandex [url] => http: //www.yandex.ru [status] => 1
)

[1] => stdClass Object(
  [id] => 2 [name] => VKontakte [url] => http; //www.vk.com [status] => 1
)

[2] => stdClass Object(
  [id] => 3 [name] => Google [url] => http: //www.google.co [status] => 1
)

[3] => stdClass Object(
  [id] => 4 [name] => Mail.ru [url] => http: //www.mail.ru [status] => 1
)

[4] => stdClass Object(
  [id] => 5 [name] => Rambler [url] => http: //www.rambler.r [status] => 1
)

Надо что бы эти данные через цикл foreach заполнялись в таблицу.

0

1 ответ 1

5
<table>
<?php foreach($array as $val) : ?>
<tr>
<td><?php echo $val->name; ?></td>
</tr>
<?php endforeach; ?>
</table>

Я вам привел пример,а дальше стройте структуру таблицы как вам угодно.

4
  • A PHP Error was encountered Severity: Notice Message: Undefined variable: array Filename: views/welcome_message.php Line Number: 29 Backtrace: File: H:\home\test1.ru\www\application\views\welcome_message.php Line: 29 Function: _error_handler File: H:\home\test1.ru\www\application\controllers\Welcome.php Line: 18 Function: view File: H:\home\test1.ru\www\index.php Line: 315 Function: require_once
    – Shufler3
    14 дек 2016 в 7:15
  • 29 <?php foreach($array as $val) : ?>
    – Shufler3
    14 дек 2016 в 7:15
  • вместо $array укажите название вашего массива
    – P. Fateev
    14 дек 2016 в 7:23
  • Все норм я тут ошибку сам сделал спасибо
    – Shufler3
    14 дек 2016 в 7:25

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.