Welcome Guest, Not a member yet? Register   Sign In
Issue with database record updating: updating record inside a foreach loop?
#17

[eluser]papanyaraka[/eluser]
[quote author="Salvatore Formisano" date="1260983567"][quote author="saidai jagan" date="1260983116"]hai u can directly giv like this ?
Code:
$this->m__crud->update_record("photos",$key,$value);
[/quote]

Hi there,

yes I can, as you can see I am referencing a model, here's the update_record method of that model:

Code:
function update_record($table,$id,$data)
{
$this->db->where('id',$id);
$this->db->update($table,$data);
}
[/quote]

I Have the same problem with yours...
here's my code
Code:
foreach($stock_list as $key=>$value):
   $hpp=round($stock_list[$key]['hpp_cur'],2);    
   $array_hpp_part=array(
    'bidckdcoy'=>$info['criteria_coy'],
    'bidckdcab'=>$info['criteria_cab'],
    'bidcnotranp'=>$stock_list[$key]['notranp'],
    'bidckdtrn'=>$stock_list[$key]['kodetranp'],    
    'bidcpartno'=>$stock_list[$key]'no_part']                            
    );
     $this->SvcBilling_model->updateSvcBillingDetailHPP($array_hpp_part,$hpp);
endforeach;
Model :
Code:
function updateSvcBillingDetailHPP($SvcBillingInfo,$bidnhpp)
    {
        $this->db->where('bidckdcoy', $SvcBillingInfo['bidckdcoy']);
        $this->db->where('bidckdcab', $SvcBillingInfo['bidckdcab']);
        $this->db->where('bidcnotranp', $SvcBillingInfo['bidcnotranp']);
        $this->db->where('bidckdtrn', $SvcBillingInfo['bidckdtrn']);
        $this->db->where('bidcpartno', $SvcBillingInfo['bidcpartno']);
        $this->db->set('bidnhpp',$bidnhpp);
        $this->db->update('dtsvbilld');
      }

It's work for several record then it's STOP without any error;
I've try to echo the last update query and run it directly on mysql and it works fine.

Can anyone Solve this problem. Thanks.


Messages In This Thread
Issue with database record updating: updating record inside a foreach loop? - by El Forum - 12-16-2009, 07:58 AM



Theme © iAndrew 2016 - Forum software by © MyBB