在传递给视图渲染(codeigniter)之前修改DB值?

时间:2011-02-24 11:07:01

标签: php codeigniter

获取传递到$ data ['rowVideo']的数据库,但我想更改/修改数组中的值?这样做最好的方法是什么?

    $SQL = "SELECT * FROM video";
    $query = $this->db->query($SQL);
    $data['rowVideo'] = $query->fetchAll(PDO::FETCH_ASSOC);

    foreach ($data['rowVideo'] as $key => $value) {

     // do some  $data['rowVideo'] alteration
     // How would you do it?

    }



   $this->load->view('content', $data);

1 个答案:

答案 0 :(得分:2)

只是做:

$data['rowVideo'][$key] = $modifiedValueCreatedFromValue;