I wonder if you have some way to get the results of a separate select through php. I have two foreign keys in the same table, set to the same place, they are tj.fk_time_mandante and tj.fk_time_visitante.
SELECT tt.ds_nome, tti.ds_nome
FROM tb_jogo AS tj INNER JOIN tb_time AS tt ON tj.fk_time_mandante = tt.id_time
INNER JOIN tb_time AS tti ON tj.fk_time_visitante = tti.id_time
I already used mysql_fetch_array but it joins the tt.ds_name and tti.ds_name, I wanted them to be inserted into separate variables Example:
while($row = mysql_fetch_array($sql)){
echo $row['ds_nome1']; <- para tt.ds_time da consulta
echo $row['ds_nome2']; <- para tti.ds_time da consulta
}
I have already tested the query in the database, and returned the correct result. Note: I am not using any framework