0
獲取數據庫傳遞到$ data ['rowVideo']但我想改變/修改數組中的值?這樣做的最好方法是什麼?在傳遞查看渲染(codeigniter)之前修改DB值?
$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);
你的意思是這樣的例子嗎? $ data ['rowVideo'] [$ key] ['second'] = secondToMins($ data ['rowVideo'] [$ key] ['second']) – user622378
完全如此 – 2011-02-24 12:31:36