I have the following structure:
Ihave3typesofclassification,followingthecoherence:1.0.0,1.1.0,1.1.1,1.1.2
-Ihavetodisplayinfrontofthetitles,eachcontentthatbelongstoitsclassification,beingasfollowsatthetimeofdisplayingonscreen:
>1.MeuconteudoAdministrativo>1.1NovoConteudo>1.1.1AndréRibeiro>1.1.2TestedeGestãodePessoas
Youneedtofolloweachfield.
I'musingcodeigniter,butitcanbedoneinbasicPHPsameSQL,andIsetitincodeigniter.
Itriedtodoitasfollows:
$this->db->select("coe_classificacao");
$this->db->where("set_base != ", 12); // conteudo sobre
$this->db->order_by("coe_classificacao", "ASC");
$this->db->group_by("coe_classificacao");
$consulta = $this->db->get('conteudos')->result();
foreach($consulta as &$valor){
$this->db->select("coe_titulo, coe_classificacao, coe_classificacao_1, coe_classificacao_2");
$this->db->where("set_base != ", 12); // conteudo sobre
$this->db->where("coe_classificacao", $valor->coe_classificacao);
$this->db->order_by("coe_classificacao_1", "ASC");
$retorno = $this->db->get('conteudos')->result();
foreach($retorno as &$valor_retorno){
$this->db->select("coe_titulo, coe_classificacao_1, coe_classificacao_2");
$this->db->where("set_base != ", 12); // conteudo sobre
$this->db->where("coe_classificacao_1", $valor_retorno->coe_classificacao_1);
$this->db->order_by("coe_classificacao_2", "ASC");
$valor_retorno->sub = $this->db->get('conteudos')->result();
}
}
But similarly, it does not bring me the expected result, I believe you can disregard what I did.
The question is: How do I turn everything into an array so that I can display the way I transcribed it?