Viewing table content (using PHP foreach?)

I’m working on a WordPress site and am using a plugin called ‘Simple Fields’, to add data to repeatable fields. I’ve entered data into three fields: (audioinfo, audiofile, audiocomposer).

I would now like to create a post that displays that information in the following way:

Audio Info 1

Audio File 1

Audio Composer 1

~~~

Audio Info 2

Audio File 2

Audio Composer 2

I’ve been trying to figure this out with foreach. Here’s the closest I can arrive at (thought I know it’s invalid). Can anyone make any suggestions of how to handle this?


(Just as a side note, in case it’s important, the first three lines appear to all be valid – that is, if I do a “foreach” on $audiocomposer alone, I successfully get: Bach Handel Beethoven.)

Is there something I can do to apply “foreach” to all three at the same time?

Thanks!

Assuming all the arrays of same length, making use of a normal for loop.

<?php
$audioinfo = simple_fields_values("audioinfo");
$audiofile = simple_fields_values("audiofile");
$audiocomposer = simple_fields_values("audiocomposer");

for($i=0;$i
Hello, buddy!稿源:Hello, buddy! (源链) | 关于 | 阅读提示

本站遵循[CC BY-NC-SA 4.0]。如您有版权、意见投诉等问题,请通过eMail联系我们处理。
酷辣虫 » 综合编程 » Viewing table content &lpar;using PHP foreach&quest;&rpar;

喜欢 (0)or分享给?

专业 x 专注 x 聚合 x 分享 CC BY-NC-SA 4.0

使用声明 | 英豪名录