I have a table with all states with a STATE ID column, and one of the right state name. When the user registers goes the number of the state with the register of him, then I need to make a query for example if in the register of the user it is written that the id of the state is 10, there it inquires of which the name of the state this with the id number 10 and displays the name
I'm with the code so, I have not added the schema I mentioned above!
$mysql = new mysqli("localhost", "joao", "123", "final");
$query = $mysql->query("SELECT * FROM c_clientes INNER JOIN c_clientes_enderecos ON c_clientes_enderecos.cliente_id = c_clientes.cliente_id;");
while($row = $query->fetch_array()){
echo
"<tr>" . "<td>" . $row['cliente_id']. "</td>" .
"<td>" . utf8_encode($row['cliente_nome']. " " . $row['cliente_sobrenome']). "</td>" .
"<td>" . $row['cliente_nome_mae']. "</td>" .
"<td>" . $row['cliente_email']. "</td>" .
"<td>" . $row['cliente_telefone']. "</td>" .
"<td>" . $row['cliente_celular']. "</td>" .
"<td>" . $row['cliente_cpf']. "</td>" .
"<td>" . $row['cliente_rg']. "</td>" .
"<td>" . $row['cliente_nascimento_mae']. "</td>" .
"<td>" . $row['cliente_status']. "</td>" .
"<td>" . $row['cliente_data_emprego']. "</td>" .
"<td>" . $row['usuario_id']. "</td>" .
"<td>" . $row['cliente_mae_estado_id']. "</td>" .
"<td>" . $row['regiao_id']. "</td>" .
"<td>" . $row['cliente_habilitado_regiao']. "</td>" .
"<td>" . $row['endereco_id']. "</td>" .
"<td>" . $row['endereco_cep']. "</td>" .
"<td>" . utf8_encode($row['endereco_rua']). "</td>" .
"<td>" . $row['endereco_numero']. "</td>" .
"<td>" . $row['endereco_complemento']. "</td>" .
"<td>" . $row['cidade_id']. "</td>" .
"<td>" . $row['estado_id']. "</td>" . //Aqui vem o id quero
//transformar no nome!
"<td>" . $row['c_clientes_enderecos']. "</td>" . "</tr>"
;
}