【发布时间】:2015-03-30 13:58:17
【问题描述】:
我正在尝试从 mysql 中获取一些数据,例如论坛名称 cmets 编号。
我的代码是这样的
<?php foreach(fetch('forum_threads', 'limit=5') as $forum_thread) : ?>
<?php foreach(fetch('forums', 'limit=5') as $forum) : ?>
<?php foreach(fetch('forum_sections', 'limit=5') as $forum_section) : ?>
<li>
<img src="/themes/<?php echo setting('themes.default_theme') ?>/assets/images/ico/neo-white.png">
<a href="#comments" class="comments anim-01"><span class="anim-01"><?= $forum_thread->forum_posts_number ?></span></a>
<h3><a href="./forums/<?= $forum->url_name ?>/<?= $forum_thread->id ?>/<?= $forum_thread->url_title ?>"><?= $forum_thread->title ?></a></h3>
<span class="meta"><a href="./articles/<?= $article->section->url_name ?>"><?= $forum_section->name ?></a> - <abbr class="timeago" title="<?= $forum_thread->created_at ?>"><?= $forum_thread->created_at ?></abbr></span>
</li>
<?php endforeach; ?>
<?php endforeach; ?>
<?php endforeach; ?>
看起来一切正常,但我有 5 个类似的论坛主题:
HELLO
HELLO
HELLO
HELLO
HELOO
HELLO2
HELLo2
HELLO2
HELLO2
HELLO2
我想做的事情是这样的:
HELLO
HELLO2.
对不起,我的英语不好,感谢您的回答!干杯
【问题讨论】:
-
无法回答,你必须给出你正在做的代码
echo $myforumthreadname或类似的东西。 -
我试过这样: 但同样的问题
-
问题不在你的循环中,而是在之后。但是我们需要看到更多你的代码来回答......
-
感谢您的回答。脚本后代码:pastebin.com/bE6WjkGT
标签: php mysql codeigniter frameworks