Group tables and return to json

Asked

Viewed 77 times

0

I have this function that returns the data to Ajax:

public function get_agenda(){
    $this->db->select('prospect_agendamento.age_data_agendado_para as start, prospect.pro_nome as title, prospect.pro_id as id ');
    $this->db->where('prospect_agendamento.age_data_agendado_para BETWEEN "'. date('Y-m-d', strtotime($_GET['start'])). '" and "'. date('Y-m-d', strtotime($_GET['end'])).'"');
    $this->db->join("prospect", "prospect.pro_id=prospect_agendamento.age_id_prospect");
    $retorno = $this->db->get('prospect_agendamento')->result();
    echo json_encode($retorno); 
}

Until then, everything works perfectly. However, I need to add to this same return, another listing, which will compose the json.

That would be of this table structure:

inserir a descrição da imagem aqui

The other function I have to group is this:

public function get_agenda_1(){
    $this->db->select('tarefa.tar_data_inicial as start, tarefa.tar_data_final as end, tarefa.tar_titulo as title');
    $retorno = $this->db->get('tarefa')->result();
    echo json_encode($retorno);
}

How can I make a new list?

  • The returns are different ? of each function I say ...

  • Are the same, title, start and end

  • They’re different from what I saw from one look

  • Yes, the table fields are different, but the return I need is equal.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.