⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

how to callback_after_update



DREON
  • profile picture
  • Member

Posted 21 March 2013 - 03:27 AM

 i have a problem on how i put my code on callback_after update

 this is my callback on my add_action.

 

my problem ishow can i put these code on my callback_after_update.. thnx

 

function copyrows($primary_key)
    {
            $this->db->where('officeCode',$primary_key);
            $rs = $this->db->get('offices')->row_array();
            
            $data['officeCode'] = $rs['officeCode'];
            $data['city'] = $rs['city'];
            $data['phone'] = $rs['phone'];
            $data['addressLine1'] = $rs['addressLine1'];
            $data['addressLine2'] = $rs['addressLine2'];
            $data['state'] = $rs['state'];
            $data['postalCode'] = $rs['postalCode'];
            $data['country'] = $rs['country'];
            $data['territory'] = $rs['territory'];
            $data['checking'] = $rs['checking'];
            
           
            $this->db->insert('offices1', $data);


victor
  • profile picture
  • Member

Posted 21 March 2013 - 07:57 AM

your logic is wrong. When you will update a row, your script will be insert copies of row into second tables every time! For example you'll click "update" 5 times and script insert 5 new row into second table


DREON
  • profile picture
  • Member

Posted 22 March 2013 - 22:48 PM

sir victor can you give me some example on my function? thnx


victor
  • profile picture
  • Member

Posted 23 March 2013 - 06:47 AM

Why did you put your function into callback_after_update?


DREON
  • profile picture
  • Member

Posted 24 March 2013 - 23:06 PM

sir victor what is the right logic/ code for that callbacl_after_update?thnx


victor
  • profile picture
  • Member

Posted 24 March 2013 - 23:12 PM

it's difficult for me to explain this for you because you don't have skills in php.


victor
  • profile picture
  • Member

Posted 24 March 2013 - 23:20 PM

do you know OOP?


DREON
  • profile picture
  • Member

Posted 25 March 2013 - 04:32 AM

i know about php and oop sir victor, but im not an advanced user or skills in php/oop