Форум программистов, компьютерный форум, киберфорум
PHP для начинающих
Войти
Регистрация
Восстановить пароль
Карта форума Темы раздела Блоги Сообщество Поиск Заказать работу  
 
0 / 0 / 0
Регистрация: 01.06.2012
Сообщений: 8
1

Вывод нужных данных с массива через foreach в php

24.02.2014, 14:01. Показов 1214. Ответов 0
Метки нет (Все метки)

Author24 — интернет-сервис помощи студентам
Здравствуйте! У меня возникла проблема, как вывести нужное значение с массива используя цикл foreach?
вот часть массива:
PHP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
$left_rows = print_r_reverse('Array
(
    [0] => html_table_row Object
        (
            [id] =>
            [cells] => Array
                (
                    [0] => html_table_cell Object
                        (
                            [id] =>
                            [text] =>
                            [abbr] =>
                            [colspan] => 2
                            [rowspan] =>
                            [scope] =>
                            [header] =>
                            [style] =>
                            [attributes] => Array
                                (
                                    [class] => fixedcolumn cell topleft
                                )
 
                        )
 
                )
 
            [style] =>
            [attributes] => Array
                (
                    [class] =>
                )
 
        )
 
    [1] => html_table_row Object
        (
            [id] =>
            [cells] => Array
                (
                    [0] => html_table_cell Object
                        (
                            [id] => studentheader
                            [text] => <a href="index.php?id=20&amp;sortitemid=lastname">Прізвище</a><img class="iconsmall sorticon" alt="Sort in ascending order" title="Sort in ascending order" src="http://el.puet.edu.ua/dev/theme/image.php?theme=overlay&amp;component=core&amp;image=t%2Fsort_asc" /> <a href="index.php?id=20&amp;sortitemid=firstname">Ім"я</a>
    [abbr] =>
                            [colspan] => 2
                            [rowspan] =>
                            [scope] => col
                            [header] => 1
                            [style] =>
                            [attributes] => Array
    (
        [class] => header
                                )
 
                        )
 
                )
 
            [style] =>
            [attributes] => Array
    (
        [class] => heading
                )
 
        )
 
    [2] => html_table_row Object
    (
        [id] => fixed_user_131
            [cells] => Array
    (
        [0] => html_table_cell Object
    (
        [id] =>
                            [text] => <a href="http://el.puet.edu.ua/dev/user/profile.php?id=131"><img src="http://el.puet.edu.ua/dev/theme/image.php?theme=overlay&amp;component=core&amp;image=u%2Ff2" alt="Фото anonlastname103 anonfirstname103" title="Фото anonlastname103 anonfirstname103" class="userpicture defaultuserpic" width="35" height="35" /></a><a href="http://el.puet.edu.ua/dev/user/view.php?id=131&amp;course=20">anonlastname103 anonfirstname103</a><img src="http://el.puet.edu.ua/dev/theme/image.php?theme=overlay&amp;component=core&amp;image=i%2Fenrolmentsuspended" title="Реєстрацію користувача заблоковано" alt="Реєстрацію користувача заблоковано" class="usersuspendedicon" />
                            [abbr] =>
                            [colspan] =>
                            [rowspan] =>
                            [scope] => row
                            [header] => 1
                            [style] =>
                            [attributes] => Array
    (
        [class] => user usersuspended
                                )
 
                        )
 
                    [1] => html_table_cell Object
    (
        [id] =>
                            [text] => <a class="action-icon" href="http://el.puet.edu.ua/dev/grade/report/user/index.php?userid=131&amp;id=20"><img alt="Grades for anonlastname103 anonfirstname103" class="smallicon" title="Grades for anonlastname103 anonfirstname103" src="http://el.puet.edu.ua/dev/theme/image.php?theme=overlay&amp;component=core&amp;image=t%2Fgrades" /></a>
    [abbr] =>
                            [colspan] =>
                            [rowspan] =>
                            [scope] =>
                            [header] => 1
                            [style] =>
                            [attributes] => Array
    (
        [class] => userreport
                                )
 
                        )
 
                )
 
            [style] =>
            [attributes] => Array
    (
        [class] => r0 odd
                )
 
        )
 
    [3] => html_table_row Object
    (
        [id] => fixed_user_134
            [cells] => Array
    (
        [0] => html_table_cell Object
    (
        [id] =>
                            [text] => <a href="http://el.puet.edu.ua/dev/user/profile.php?id=134"><img src="http://el.puet.edu.ua/dev/theme/image.php?theme=overlay&amp;component=core&amp;image=u%2Ff2" alt="Фото anonlastname106 anonfirstname106" title="Фото anonlastname106 anonfirstname106" class="userpicture defaultuserpic" width="35" height="35" /></a><a href="http://el.puet.edu.ua/dev/user/view.php?id=134&amp;course=20">anonlastname106 anonfirstname106</a><img src="http://el.puet.edu.ua/dev/theme/image.php?theme=overlay&amp;component=core&amp;image=i%2Fenrolmentsuspended" title="Реєстрацію користувача заблоковано" alt="Реєстрацію користувача заблоковано" class="usersuspendedicon" />
                            [abbr] =>
                            [colspan] =>
                            [rowspan] =>
                            [scope] => row
                            [header] => 1
                            [style] =>
                            [attributes] => Array
    (
        [class] => user usersuspended
                                )
 
                        )
 
                    [1] => html_table_cell Object
    (
        [id] =>
                            [text] => <a class="action-icon" href="http://el.puet.edu.ua/dev/grade/report/user/index.php?userid=134&amp;id=20"><img alt="Grades for anonlastname106 anonfirstname106" class="smallicon" title="Grades for anonlastname106 anonfirstname106" src="http://el.puet.edu.ua/dev/theme/image.php?theme=overlay&amp;component=core&amp;image=t%2Fgrades" /></a>
    [abbr] =>
                            [colspan] =>
                            [rowspan] =>
                            [scope] =>
                            [header] => 1
                            [style] =>
                            [attributes] => Array
    (
        [class] => userreport
                                )
 
                        )
 
                )
 
            [style] =>
            [attributes] => Array
    (
        [class] => r1 even
                )
 
        )
 
    [4] => html_table_row Object
    (
        [id] => fixed_user_136
            [cells] => Array
    (
        [0] => html_table_cell Object
    (
        [id] =>
                            [text] => <a href="http://el.puet.edu.ua/dev/user/profile.php?id=136"><img src="http://el.puet.edu.ua/dev/theme/image.php?theme=overlay&amp;component=core&amp;image=u%2Ff2" alt="Фото anonlastname108 anonfirstname108" title="Фото anonlastname108 anonfirstname108" class="userpicture defaultuserpic" width="35" height="35" /></a><a href="http://el.puet.edu.ua/dev/user/view.php?id=136&amp;course=20">anonlastname108 anonfirstname108</a><img src="http://el.puet.edu.ua/dev/theme/image.php?theme=overlay&amp;component=core&amp;image=i%2Fenrolmentsuspended" title="Реєстрацію користувача заблоковано" alt="Реєстрацію користувача заблоковано" class="usersuspendedicon" />
                            [abbr] =>
                            [colspan] =>
                            [rowspan] =>
                            [scope] => row
                            [header] => 1
                            [style] =>
                            [attributes] => Array
    (
        [class] => user usersuspended
                                )
 
                        )
 
                    [1] => html_table_cell Object
    (
        [id] =>
                            [text] => <a class="action-icon" href="http://el.puet.edu.ua/dev/grade/report/user/index.php?userid=136&amp;id=20"><img alt="Grades for anonlastname108 anonfirstname108" class="smallicon" title="Grades for anonlastname108 anonfirstname108" src="http://el.puet.edu.ua/dev/theme/image.php?theme=overlay&amp;component=core&amp;image=t%2Fgrades" /></a>
    [abbr] =>
                            [colspan] =>
                            [rowspan] =>
                            [scope] =>
                            [header] => 1
                            [style] =>
                            [attributes] => Array
    (
        [class] => userreport
                                )
 
                        )
 
                )
 
            [style] =>
            [attributes] => Array
    (
        [class] => r2 odd
                )
 
        )
результат который выдаёт браузер на картинке.

Как сделать так, чтобы выводило в столбик лишь то, что на второй картинке.
Миниатюры
Вывод нужных данных с массива через foreach в php  
Изображения
 
0
Programming
Эксперт
94731 / 64177 / 26122
Регистрация: 12.04.2006
Сообщений: 116,782
24.02.2014, 14:01
Ответы с готовыми решениями:

Неправильно работает вывод массива через foreach
Есть массив $childResult (print_r): Array ( =&gt; Array ( =&gt; 4 =&gt; Steam =&gt; 0 =&gt; =&gt; 1 ) =&gt;...

Вывод части данных из таблицы mySQL через PHP
Здравствуйте. Только начал изучать PHP, возникла следующая проблема: есть форма, на ней два ...

Вывод таблицы базы данных MySQL через PHP
Всем доброго времени суток. Я пытался вывести таблицу из базы данных Денвера в браузер, результат...

Цикл foreach и вывод данных
Есть скрипт, который выводит данные из БД в следующем виде: id название цена 1 карандаш 100 2...

0
24.02.2014, 14:01
IT_Exp
Эксперт
87844 / 49110 / 22898
Регистрация: 17.06.2006
Сообщений: 92,604
24.02.2014, 14:01
Помогаю со студенческими работами здесь

Вывод материалов из одной категории через цикл foreach
Добрый день, реализован метод для вывода материалов из базы данных с помощью цикла foreаch в таком...

Вывод вложенного массива foreach
Добрый вечер пытаюсь сделать вывод вложенного массива, подскажите где ошибка &lt;?php $usersInd...

Вывод таблицы из бд MySQL через php в браузер, с возможностью вноса и изменения данных прямо через ячейки
Всем здравствуйте, в общем, такая вот проблема: Есть код: &lt;!doctype html&gt; &lt;html&gt; &lt;head&gt;...

Вывод данных в html таблицу , через php
Доброй ночи! Не могу разобраться, почему не выводится данные из массива (приложил скрин вывода...


Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:
1
Ответ Создать тему
КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2024, CyberForum.ru