0
I have two client charts, one called personal and one called personal I need to load both tables within 1(a select) using php and codeigniter 3.6.
Be able to load the personal table, as follows the code in the controller and in the view below, remembering that the table Attendance has the foreign keys of the personal table (fkcodpf) and the personal table (fkcodpj):
CONTROLER
class Atendimento extends CI_Controller {
public function cadastro() {
$dados['pessoafisica'] = $this->db->get('pessoafisica')->result();
$this->load->view('includes/html_header');
$this->load->view('includes/menu');
$this->load->view('cadastrar/cad_atendimento', $dados);
}
}
Customer Registration VIEW (select)
<label>Nome do Cliente</label>
<select id="fkcodpf" name="fkcodpf" class="form-control" >
<option value=""></option>
<?php foreach ($pessoafisica as $pf) { ?>
<option value="<?= $pf->codpf ?>"> <?= $pf->nomepessoafisica; ?></option>
<?php } ?>
</select>
But how to click together on this select, the personal table? If possible by sorting by personal name, followed by personal name?
Would Voce use subqueris in SQL could solve your problem ?
– Alex
In case I’d have to use
$this->db->query("SELECT ....")
– Alex
would be able to explain me better Marcelo? what would this query look like in Controller and what would I call it in View? thanks.
– Ramiro
I don’t know exactly what you want to do by putting these two tables together. You can take a look at some tutorials on the internet on how to do Queries, easy
– Alex
This is grabbing my personal advocacy office project. I need to do this because a service can be done to a physical or legal person. And as I made a table for each type of person, I have to always manipulate two tables.
– Ramiro
I think Queries does not solve my problem, because the tables have no relation to each other. Or need not have?
– Ramiro