【发布时间】:2014-07-16 09:08:24
【问题描述】:
我将所有数据从表中获取到数组中:
$records = $this->Misc->getAll('table');
接下来我做了一个循环
foreach ($records as $key => $record) {
// here i want to update a column in the fist
// row with a value from the second row
$this->Misc->update($record->id; $value_of_a_column_from_the_next_row);
}
我该怎么做? 谢谢
【问题讨论】:
-
这很不寻常,你到底想做什么?我可以给你一个“解决方案”,但我怀疑它是否真的能解决你的问题。
-
您只想更新第一条记录还是要从所有条记录中转移值?更多上下文会有所帮助。
-
第一行 'a1','a2','a3','null ','a4' ..... 第二行 'b1','b2','b3','X' ,'b4' .....我想将X添加到空位置。
标签: php mysql arrays codeigniter