1
I have the function that returns all registered tags: (With the ID and TAG fields)
public function lista(){
$lista = array();
$n = 0;
$db = new mysql();
$exec = $db->executar("SELECT * FROM automovel_marca order by marca asc");
while($data = $exec->fetch_object()){
$lista[$n]['id'] = $data->id;
$lista[$n]['marca'] = $data->marca;
$n++;
}
return $lista;
}
And the function that returns the models: (With the fields ID, IDMARK and MODEL)
public function lista(){
$lista = array();
$n = 0;
$db = new mysql();
$exec = $db->executar("SELECT * FROM automovel_modelo order by modelo asc");
while($data = $exec->fetch_object()){
$lista[$n]['id'] = $data->id;
$lista[$n]['idmarca'] = $data->idmarca;
$lista[$n]['modelo'] = $data->modelo;
$n++;
}
return $lista;
}
I was able to pull them individually in FORMS, the problem is that I wanted the FORM MODEL field to be related to the BRAND field, when the person selects the brand it displays all the models referring to that brand.
The structure of DB is like this:
car brand (id, brand) automobile model (id,idmark,model) - in this case the idmark follows the relation of the car ID