在列数据中使用foreach循环

时间:2013-05-01 07:03:00

标签: php html for-loop foreach

我怎样才能使它只对数据而不是html列进行预测?

    <div class="columns">
        <div class="title">Donation Amount</div>
        <div class="title">Support</div>
        <div class="title">View Grant</div>

<?php foreach ($results->result() as $grant) : ?>
        <div class="col1"><p>AUD $<?php echo number_format($grant->user_budget);?></p></div>
        <div class="col2"></div>
        <div class="col3"></div>
    </div>
        <div class="clear"></div>
    <?php endforeach ; ?>

1 个答案:

答案 0 :(得分:0)

试试这个

   <div class="columns">
        <div class="title">Donation Amount</div>
        <div class="title">Support</div>
        <div class="title">View Grant</div>

<?php foreach ($results->result() as $grant) : ?>
        <div class="col1"><p>AUD $<?php echo number_format($grant->user_budget);?></p></div>
        <div class="col2"></div>
        <div class="col3"></div>
        <div class="clear"></div>
  <?php endforeach ; ?>
    </div>