/    Sign up×
Community /Pin to ProfileBookmark

Echoing results after double query

How is the correct way to echo results of this query?
[/code]
$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);

[code=php]

Like this doesn’t seem to work:

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

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@Sux0rZh_jc0rzNov 24.2003 — How is the correct way to echo results of this query?

<? echo $result; ?>

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

Copy linkTweet thisAlerts:
@Sux0rZh_jc0rzNov 24.2003 — 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);

&lt;? echo $disponibilidad.ene1 ?&gt;
&lt;? echo $disponibilidad.ene2 ?&gt;
&lt;? echo $disponibilidad.ene3 ?&gt;
&lt;? echo $disponibilidad.ene4 ?&gt;
&lt;? echo $disponibilidad.ene5 ?&gt;

ect...
Copy linkTweet thisAlerts:
@PerfidusauthorNov 24.2003 — 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.
Copy linkTweet thisAlerts:
@DaiWelshNov 24.2003 — $result=mysql_query("SELECT .......................);

[B]$row=mysql_fetch_array($result);[/B]

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).
×

Success!

Help @Perfidus spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.5,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...