两个Foreach循环

时间:2015-02-06 10:23:09

标签: php mysql codeigniter

我的目标是结合两个foreach循环。这是代码:

<?php
        if(isset($query))
        {
            foreach($query as $row){//there should be another foreach loop here with the condition ($query2->row) 
                echo '<a href="'.base_url().'site/timeline/'.$row->projectId.'"><div class="projbox"> ';
                echo '<div id="proj-head">'.$row->Title.'</a></div>';
                date_default_timezone_set('Asia/Manila');
                $now = date('Y-m-d');
                /*if (($now>$row2->pre_proc_conference)&&($now<$row2->post_of_ieab)){
                    echo '<progress value="11" max="100" id="prog-head"></progress><br/>';
                }
                if (($now>$row2->post_of_ieab)&&($now<$row2->pre_bid_conference)){
                    echo '<progress value="22" max="100" id="prog-head"></progress><br/>';
                }
                if (($now>$row2->pre_bid_conference)&&($now<$row2->elegibility_check)){
                    echo '<progress value="33" max="100" id="prog-head"></progress><br/>';
                }
                if (($now>$row2->elegibility_check)&&($now<$row2->sub_bid)){
                    echo '<progress value="44" max="100" id="prog-head"></progress><br/>';
                }
                if (($now>$row2->sub_bid)&&($now<$row2->bid_evaluation)){
                    echo '<progress value="55" max="100" id="prog-head"></progress><br/>';
                }
                if (($now>$row2->bid_evaluation)&&($now<$row2->post_qualification)){
                    echo '<progress value="66" max="100" id="prog-head"></progress><br/>';
                }
                if (($now>$row2->post_qualification)&&($now<$row2->notice_of_award)){
                    echo '<progress value="77" max="100" id="prog-head"></progress><br/>';
                }
                if (($now>$row2->notice_of_award)&&($now<$row2->contract_signing)){
                    echo '<progress value="88" max="100" id="prog-head"></progress><br/>';
                }
                if ($now>$row2->contract_signing){
                    echo '<progress value="100" max="100" id="prog-head"></progress><br/>';
                }*/
                echo 'Date Started: '.$row->datestarted.'
                      <br />Mode of Procurement: '.$row->procurementmode.'<br/>';
                echo '</div></a>';
            }
        }
    ?>

我该怎么做?我从控制器$ query和$ query2传递了2个查询。 $ query2中的值将是生成进度条值的值。来自$ query的值将是生成其他详细信息的值。

0 个答案:

没有答案