[eluser]vps4[/eluser]
this works fine
Code:
$this->db->trans_start();
foreach ($arrs AS $arr) {
$sql = 'UPDATE last SET open = ?, close = ?, last = ?, high = ?, low = ?, buy = ?, sell = ?, volume = ?, amount = ?, update_date = ?, update_time = ? WHERE code = ? LIMIT 1;';
$this->db->query($sql, array(
$arr['open'], $arr['close'], $arr['last'], $arr['high'], $arr['low'], $arr['buy'],
$arr['sell'], $arr['volume'], $arr['amount'], $arr['update_date'], $arr['update_time'],
$arr['code']
));
}
$this->db->trans_complete();
if ($this->db->trans_status() === FALSE) {
exit('db trans wrong');
}
this NOT work!!!
Code:
$this->db->trans_start();
foreach ($arrs AS $arr) {
$this->db->update('last', $arr, array('code' => $code));
}
$this->db->trans_complete();
if ($this->db->trans_status() === FALSE) {
exit('db trans wrong');
}