Gracias por tu comentario pero ya solucione el problema mira este es la solucion:
Código PHP:
function equipos($e1){
$sqle="SELECT canchita.equipos.equipo FROM canchita.equipos WHERE canchita.equipos.idequipo=$e1";
$rese=mysql_query($sqle);
while($rege=mysql_fetch_array($rese)){
$nombre1=$rege['equipo'];
}
return $nombre1;
}
function equipos2($e2){
$sqle2="SELECT canchita.equipos.equipo FROM canchita.equipos WHERE canchita.equipos.idequipo=$e2";
$rese2=mysql_query($sqle2);
while($rege2=mysql_fetch_array($rese2)){
$nombre2=$rege2['equipo'];
}
return $nombre2;
}
function hora($h){
$sqlh="SELECT canchita.t_hora.hora FROM canchita.t_hora WHERE canchita.t_hora.idhora=$h";
$resh=mysql_query($sqlh);
while($regh=mysql_fetch_array($resh)){
$hora=$regh['hora'];
}
return $hora;
}
$sqlhl="SELECT canchita.juegos.* FROM canchita.juegos WHERE canchita.juegos.dia=1 and canchita.juegos.idjornada=$idj ORDER BY hora";
$reshl=mysql_query($sqlhl);
while($reghl=mysql_fetch_array($reshl)){
$e1=$reghl['equipo1'];
$equipo1=equipos($e1);
$e2=$reghl['equipo2'];
$equipo2=equipos2($e2);
$h=$reghl['hora'];
$hora=hora($h);
echo "<tr><td>$hora:00</td><td>$equipo1</td><td>0</td><td>vs</td><td>0</td><td>$equipo2</td></tr>";
}