Filed not updating in database

I have a form and i need to update email address when user edits it. The old eaiml should get deleted and new one should get saved. but its not working

Welcome to the forum. You will find this is a great place to ask questions and post your code using the forums per-formatted text button.

Sorry to hear about your form not working.

hi, can you help me with it?

With what? You didn’t post anything.

.js

static get_deal_building_info(deal_id, building_id){
        return new Promise(resolve => {
            let data = {
                deal_id,
                building_id
            };
            let data_obj = {
                url : `/api/dealboard/deals/${deal_id}/buildings/${building_id}`,
                ...data
            };
            this.observable_handler = new generic_handler();
            let cur_req = this.observable_handler.observable_post(data_obj);
            cur_req.subscribe(
                {
                    next: (res)=>{
                        resolve(res);
                    },
                    error: e => comparison_data.show_error(),
                    complete: () => {

                    }
                }
            );
        });
    }

.php

  $this->altoRouter->map('POST', '/api/dealboard/deals/[i:deal_id]/buildings/[i:building_id]', function($deal_id, $building_id){
            header("Access-Control-Allow-Orgin: *");
            header("Access-Control-Allow-Methods: *");
            header("Content-Type: application/json");
            header("HTTP/1.1 200 OK");
            http_response_code(200);
            $data = json_decode(file_get_contents('php://input'));
            $success = false;
            $decoded_response['message'] = "";
            $manage_sharing_permissions = new manage_sharing_permissions();
            try {
                $building_id = $data->building_id;
                if($building_id){
                    $check_deal_id = get_deal_id_from_building_id($building_id);
                    $manage_sharing_permissions->check_if_user_has_access_to_deal($check_deal_id);
                    $deal = new deal($check_deal_id);
                    $deal->read();
                    $client_id = $deal->data['client_id'];
                    $client = new client($client_id);
                    $client->read();
                    $contact=new contact($client->data['primary_contact_id']);
                    $contact->read();
                    $client->data['first_name'] = $contact->data['first_name'];
                    $client->data['email'] = $contact->data['email'];

                    $building = new building($building_id);
                    $building->read();
                    $deal_contact = new deal_contact();
                    $landlord_info = $deal_contact->get_mandatory_deal_contact($building_id,'company_contact');
                    $building->data['first_name'] = $landlord_info['first_name'];
                    $building->data['email'] = $landlord_info['email'];
                    $deal_data = $deal->data;
                    $client_data = $client->data;
                    $building_data = $building->data;

                    $decoded_response['deal_data'] = $deal_data;
                    $decoded_response['client_data'] = $client_data;
                    $decoded_response['building_data'] = $building_data;

                    $success = true;
                }
            }

query:

  function get_mandatory_deal_contact($deal_id,$request_type='company_contact'){
        $this->name = "deal_contact";
        $this->find("deal_id = '$deal_id' AND contact_type = '$request_type' AND is_mandatory = 1","","contact_level asc");
        return $this->data;
    }

this is the part of the code for updating email address when user edits it. When i try to manually update the filed value in db, its getting updates and is reflected in the page. But not through the code

I see nothing that updates anything?

Sponsor our Newsletter | Privacy Policy | Terms of Service