Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/291.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Codeigniter爆炸到html表_Php_Html_Codeigniter - Fatal编程技术网

Php Codeigniter爆炸到html表

Php Codeigniter爆炸到html表,php,html,codeigniter,Php,Html,Codeigniter,我目前有问题爆发到html表 我的控制器 public function idp_test() { $this->load->model('groups/groups_model'); $scholar_id = $this->session->userdata('scholar_id'); $groups = $this->groups_model->retrieve_groups_idp($this->scholar->

我目前有问题爆发到html表

我的控制器

public function idp_test()
{
    $this->load->model('groups/groups_model');
    $scholar_id = $this->session->userdata('scholar_id');
    $groups = $this->groups_model->retrieve_groups_idp($this->scholar->level_id);

    $content = array(
        'groups'            => $groups,
        'scholar'           => $this->scholar,
        'page_title'        => 'My individual development plan',
        'page_view'         => 'scholar/activities/idp_test',
        'page_scripts_view' => 'scholar/inc/_choose_activities_scripts',
        'sidebar_menu'      => 'idp test'
    );


    $this->load->view("theme/base", $content);
}
我的型号

public function retrieve_groups_idp($level_id)
{

    $this->db->select("groups.*, levels.name as levelname");
    $this->db->join('activities', 'groups.activity_ids = activities.activity_id' );
    $this->db->join('levels', 'levels.level_id = groups.level_id', 'left' );
    $this->db->join('activity_types', 'activities.activity_type_id = activity_types.activity_type_id', 'left' );
    $this->db->where('groups.level_id', $level_id);
    $this->db->group_by('groups_name');
    $this->db->order_by('groups_name');

    $qr = $this->db->get('groups');

    return $qr->result();
}

public function retrieve_activity_desc($activity_ids)
{
        $activity_desc_arr[] = explode(', ', $activity_ids);

        foreach ($activity_desc_arr as $activity_id){

            $this->db->select("activity_id as activityid, CONCAT(activities.name, ' - ', activity_types.name) AS description", FALSE);
            $this->db->join('activity_types', 'activities.activity_type_id = activity_types.activity_type_id');
            $this->db->where_in('activities.activity_id', $activity_id);

            $qr = $this->db->get('activities');

            return $qr->result();
        }
}
我的观点

<?php foreach ($groups as $groups): ?>
                        <table class="table table-vcenter">
                            <thead>
                                <tr class="active">
                                    <th><?php echo $groups->groups_name?></th> <!--Series Header -->
                                    <th class="text-center"><small><strong>Module Type</strong></small></th>
                                    <th class="text-center"><small><strong>Status</strong></small></th>
                                    <th class="text-center"><small><strong>Action</strong></small></th>
                                </tr>
                            </thead>
                            <tbody>
                                    <tr>
                                        <td><?php 
                                                $rows = $this->groups_model->retrieve_activity_desc($groups->activity_ids);
                                                    foreach ($rows as $row){
                                                        echo var_dump($row->description);
                                                    }
                                        ?></td>
                                        <td class="text-center">belom lagi</td>
                                        <td class="text-center">TO ATTEND</td>
                                        <td class="text-center"><a href="javascript:void(0)" class="label label-success">View Session</a></td>
                                    </tr>
                            </tbody>
                        </table>
                        <?php endforeach ?>

模块类型
状态
行动
贝洛姆拉吉
出席
我不能发布图片,所以下面是一些到目前为止的示例


用于FS |模块类型|状态|动作的系列1


系列1-系列1-CBLSeries 1-PEL | belom lagi |将出席|


我需要实现的是下面的示例


用于FS |模块类型|状态|动作的系列1


系列1-菲勒贝洛姆拉吉出席|


系列1-CBL | belom lagi |将出席|


系列1-PEL | belom lagi |将出席|


我是php和codeigniter的新手,我的英语很抱歉


谢谢

想想你的视图代码中有什么:

<tr>
  <td><?php 
    foreach($rows as $row){
      var_dump($row->description);
    }
  ?>
  </td>
  <td>belom lagi</td>
  <td>to attend</td>    
</tr>

贝洛姆拉吉
出席
当然,这些都将被打印到一个表单元格中,它如何生成其他内容,对吗

你需要的是这样的东西:

<?php
  foreach($rows as $row){
    echo "<tr>"; // you need a new row for every entry
    echo "<td>".$row->description."</td>";
    echo "<td>belom lagi</td>";
    echo "<td>to attend</td>";
    echo "</tr>";
  }
?>

想想你的视图中有什么代码:

<tr>
  <td><?php 
    foreach($rows as $row){
      var_dump($row->description);
    }
  ?>
  </td>
  <td>belom lagi</td>
  <td>to attend</td>    
</tr>

贝洛姆拉吉
出席
当然,这些都将被打印到一个表单元格中,它如何生成其他内容,对吗

你需要的是这样的东西:

<?php
  foreach($rows as $row){
    echo "<tr>"; // you need a new row for every entry
    echo "<td>".$row->description."</td>";
    echo "<td>belom lagi</td>";
    echo "<td>to attend</td>";
    echo "</tr>";
  }
?>

经过几次研究,我终于明白了,只想和大家分享一下

编辑控制器

public function idp_test()
{
    $this->load->model('groups/groups_model');
    $this->load->model('activities/activity_type_model');

    $scholar_id = $this->session->userdata('scholar_id');
    $groups = $this->groups_model->retrieve_groups_idp($this->scholar->level_id);

    foreach ($groups as $group) {
        $act_desc = $this->groups_model->retrieve_activity_desc($group->activity_ids);
        $group->activity_ids = $act_desc;
    }
编辑-查看

<!-- START TABLE HEADER -->
                        <?php foreach ($groups as $group): ?>
                        <table class="table table-vcenter">
                            <thead>
                                <tr class="active">
                                    <th><?php echo $group->groups_name?></th> <!--Series Header -->
                                    <th class="text-center"><small><strong>Module Type</strong></small></th>
                                    <th class="text-center"><small><strong>Status</strong></small></th>
                                    <th class="text-center"><small><strong>Action</strong></small></th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php foreach ($group->activity_ids as $session): ?>
                                    <tr>
                                        <td><?php echo $session->description; ?></td>
                                        <td class="text-center"><?php echo $session->modulename; ?></td>
                                        <td class="text-center">STATUS</td>
                                        <td class="text-center"><a href="javascript:void(0)" class="label label-success">View Session</a></td>
                                    </tr>
                                <?php endforeach ?>
                            </tbody>
                        </table>
                        <?php endforeach ?>

                        <!-- END 1 -->

模块类型
状态
行动
地位
按我的需要出来


谢谢stackoverflow。

经过几次研究,我终于明白了,只想和大家分享一下

编辑控制器

public function idp_test()
{
    $this->load->model('groups/groups_model');
    $this->load->model('activities/activity_type_model');

    $scholar_id = $this->session->userdata('scholar_id');
    $groups = $this->groups_model->retrieve_groups_idp($this->scholar->level_id);

    foreach ($groups as $group) {
        $act_desc = $this->groups_model->retrieve_activity_desc($group->activity_ids);
        $group->activity_ids = $act_desc;
    }
编辑-查看

<!-- START TABLE HEADER -->
                        <?php foreach ($groups as $group): ?>
                        <table class="table table-vcenter">
                            <thead>
                                <tr class="active">
                                    <th><?php echo $group->groups_name?></th> <!--Series Header -->
                                    <th class="text-center"><small><strong>Module Type</strong></small></th>
                                    <th class="text-center"><small><strong>Status</strong></small></th>
                                    <th class="text-center"><small><strong>Action</strong></small></th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php foreach ($group->activity_ids as $session): ?>
                                    <tr>
                                        <td><?php echo $session->description; ?></td>
                                        <td class="text-center"><?php echo $session->modulename; ?></td>
                                        <td class="text-center">STATUS</td>
                                        <td class="text-center"><a href="javascript:void(0)" class="label label-success">View Session</a></td>
                                    </tr>
                                <?php endforeach ?>
                            </tbody>
                        </table>
                        <?php endforeach ?>

                        <!-- END 1 -->

模块类型
状态
行动
地位
按我的需要出来


谢谢stackoverflow。

Hi@ROAL,谢谢你的评论,是的,它工作正常,但当我放置类似这样的内容时出错:echo”“;。你能帮我一下吗?不能在双引号
echo
中使用双引号,因为它过早地结束了字符串。您应该转义引号,或者使用撇号,如:
echo',或
echo”“。试着用谷歌搜索一些关于编程语言中“引用嵌套”的东西。嗨@ROAL,谢谢你的评论,是的,它工作正常,但当我输入类似这样的内容时出错:echo“”;。你能帮我一下吗?不能在双引号
echo
中使用双引号,因为它过早地结束了字符串。您应该转义引号,或者使用撇号,如:
echo',或
echo”“。试着用谷歌搜索一下编程语言中的“引用嵌套”。