Update data in other table

Update data in other table

misteammisteam Posts: 48Questions: 17Answers: 0

Is there any function like this for update ?

function logChange ( $db, $id) {

    $date = new DateTime();

    $db->insert( 'transactions_history', array(
        'user_id'           => $user_id,
        'values_log'        => $values,
        'transaction_id'    => $id,
        'date_log'          => $date->format("m-d-Y")
    ) );
}


->on( 'postEdit', function ($editor, $id, $row) {
    logChange( $editor->db(),$id);
} )

Thank you in advance!

Answers

  • colincolin Posts: 15,143Questions: 1Answers: 2,586

    Yep, that's an example on this manual page that's almost exactly the same as that. Hopefully that'll get you going,

    Colin

  • misteammisteam Posts: 48Questions: 17Answers: 0

    Hi Sir @colin,

    I think the sample would be at the same table not on an update to another table.

    Thanks

  • allanallan Posts: 61,715Questions: 1Answers: 10,107 Site admin

    The first parameter passed into the $db->insert() method is the database table that the insert will operate on. You can modify that as you need.

    Allan

Sign In or Register to comment.