Click to See Complete Forum and Search --> : Echoing results after double query


Perfidus
11-24-2003, 06:10 AM
How is the correct way to echo results of this query?
[/PHP]
$result=mysql_query("SELECT Disponibilidad.ene1, Disponibilidad.ene2, Disponibilidad.ene3, Disponibilidad.ene4, Disponibilidad.ene5, Disponibilidad.feb1, Disponibilidad.feb2, Disponibilidad.feb3, Disponibilidad.feb4, Disponibilidad.feb5, Disponibilidad.mar1, Disponibilidad.mar2, Disponibilidad.mar3, Precios.ene1, Precios.ene2, Precios.ene3, Precios.ene4, Precios.ene5, Precios.feb1, Precios.feb2, Precios.feb3, Precios.feb4, Precios.feb5, Precios.mar1, Precios.mar2, Precios.mar3, FROM Disponibilidad, Precios WHERE (Disponibilidad.Ref='$Ref' AND Precios.Ref='$Ref')",$link);
[PHP]

Like this doesn't seem to work:

<? echo $row["Precios.ene3"]; ?>

Sux0rZh@jc0rz
11-24-2003, 07:20 AM
How is the correct way to echo results of this query?

<? echo $result; ?>

to get the specifics, just put them all in variable.

Sux0rZh@jc0rz
11-24-2003, 07:26 AM
specifics:

How is the correct way to echo results of this query?

$disponibilidad.ene1=mysql_query("SELECT Disponibilidad.ene1, FROM Disponibilidad ",$link);
$disponibilidad.ene2=mysql_query("SELECT Disponibilidad.ene2, FROM Disponibilidad ",$link);
$disponibilidad.ene3=mysql_query("SELECT Disponibilidad.ene3, FROM Disponibilidad ",$link);
$disponibilidad.ene4=mysql_query("SELECT Disponibilidad.ene4, FROM Disponibilidad ",$link);
$disponibilidad.ene4=mysql_query("SELECT Disponibilidad.ene5, FROM Disponibilidad ",$link);

<? echo $disponibilidad.ene1 ?>
<? echo $disponibilidad.ene2 ?>
<? echo $disponibilidad.ene3 ?>
<? echo $disponibilidad.ene4 ?>
<? echo $disponibilidad.ene5 ?>

ect...

Perfidus
11-24-2003, 07:34 AM
But it should be a more compact way to echo the results, because the fact is that my query is longer than the one I'm showing you above.

DaiWelsh
11-24-2003, 11:16 AM
$result=mysql_query("SELECT .......................);
$row=mysql_fetch_array($result);
echo $row["Precios.ene3"];


you need the middle line of code to retrieve the first row from the result handle, then it should work as you expected (though some error handling would be a good idea too).