05/25/2017 at 10:25 am
#424067
Keymaster
@ Alex
re: Since I am not that familiar with arrays your answer does not help as I hoped it will.
Do this instead so you do not have to deal with arrays or manually accessing the database at all:
// Get the entry you wish to modify.
$data = Connections_Directory()->retrieve->entry( 42409 );
// Setup the entry.
$entry = new cnEntry( $data );
// Get the address, by id, that you wish to change the district field.
$address = $entry->addresses->get( 38437 );
// Set the new value for the district field.
$address->setDistrict( 'new' );
// Update the address in the entry with the modified address.
$entry->addresses->update( 38437, $address );
// Save the changes back to the database.
$entry->update();
- Change
42409to the entry you wish to update. - Change
38437to the address id you wish to update the district.
Does that help?
