3
I need to change the keys of a result obtained by mysqli_result->fetch_assoc()
If I do this research :
"SELECT exemplo.nome, exemplo.apelido, exemplo.idade FROM exemplo WHERE exemplo.id=1"
get this result
$result["nome"]= "António";
$result["apelido"] = "Silva";
$result["idade"] = "30";
and would like to receive or transform into :
$result["exemplo.nome"]= "António";
$result["exemplo.apelido"] = "Silva";
$result["exemplo.idade"] = "30";
I can’t use aliases in the search phrases
"SELECT exemplo.nome as exemplo.nome , exemplo.apelido as exemplo.apelido, exemplo.idade as exemplo.idade FROM exemplo WHERE exemplo.id=1";
Any suggestions?
But why do you want to do it?
– Lucas
You can go by "example name" if it helps...
– Jorge B.
Pq you cannot use alias this column is called after?
– rray
I am so sorry, but this is the problem that I have. It is no use to question why it has to be like this. I can only touch the keys of the result.
– Manuel Gerardo Pereira
Then you need to reindexe the entire array with that prefix
exemplo
?– rray
Could be an @rray solution
– Jorge B.
@Manuelgerardopereira can create a view in the bank?
– gmsantos