Skip to main content

Show Posts

This section allows you to view all Show Posts made by this member. Note that you can only see Show Posts made in areas you currently have access to.

Messages - lili

4
General Discussion / UpdateRecord in page event with table_data's value from other table
Here is my tables:
user -> user_id, username, password, email, name, address_u
data -> data_id, user_id_d, address_d, data_1, data_2

and then i use this UpdateRecord Page Event statement in AfterAdd in 'data' table:
Code: [Select]
$table_data = array(
    "user_id_d" => "value",
    "address_d" => "value2"
);
$db->where("data_id", $rec_id);
$bool = $db->update("data", $table_data);

what code above does is when i add a record to 'data' table, the current record will have "user_id_d" and "address_d" autofilled with "value" and "value2".
my question is, is there anyway to replace "value" and "value2" with dynamic value from other table?
for example what i want to do here is:
Quote
"user_id_d" => get user_id from user
"address_d" => get address_u from user
something like that. is there anyway to achieve it?