Hi,
I have a question, i have an mysql query which returns an associative array which looks like this:
$scores = _QueryRow("SELECT COUNT(*), MIN(score_0), MAX(score_0), FORMAT(AVG(score_0),2), MIN(score_1), MAX(score_1), FORMAT(AVG(score_1),2), MIN(score_2), MAX(score_2), FORMAT(AVG(score_2),2), MIN(score_3), MAX(score_3), FORMAT(AVG(score_3),2), MIN(score_4), MAX(score_4), FORMAT(AVG(score_4),2), MIN(score_5), MAX(score_5), FORMAT(AVG(score_5),2)
FROM reviews
WHERE categoryid='$categoryid'
AND productlistid='$productlistid'");
now in $scores are the min, max and average values of score_0 till score_5
with print_r($scores) i can see that it is filled with the correct values..
however i want to display these values in a more nicer way but i can'tt seem to get these values out of my associative array, could anyone help please..
currently i use this line, but it doesn't work:
for ($e=0;$e<5;$e++){
echo "score $e: ".$scores[MIN({score_.$e})]
}
even if i try using just
echo "test: ". $score[MIN(score_0)]."<BR>";
it won't work.. how do you get associative array names like these MIN() and MAX() displayed?
Thanks in advance for the help..
I have a question, i have an mysql query which returns an associative array which looks like this:
$scores = _QueryRow("SELECT COUNT(*), MIN(score_0), MAX(score_0), FORMAT(AVG(score_0),2), MIN(score_1), MAX(score_1), FORMAT(AVG(score_1),2), MIN(score_2), MAX(score_2), FORMAT(AVG(score_2),2), MIN(score_3), MAX(score_3), FORMAT(AVG(score_3),2), MIN(score_4), MAX(score_4), FORMAT(AVG(score_4),2), MIN(score_5), MAX(score_5), FORMAT(AVG(score_5),2)
FROM reviews
WHERE categoryid='$categoryid'
AND productlistid='$productlistid'");
now in $scores are the min, max and average values of score_0 till score_5
with print_r($scores) i can see that it is filled with the correct values..
however i want to display these values in a more nicer way but i can'tt seem to get these values out of my associative array, could anyone help please..
currently i use this line, but it doesn't work:
for ($e=0;$e<5;$e++){
echo "score $e: ".$scores[MIN({score_.$e})]
}
even if i try using just
echo "test: ". $score[MIN(score_0)]."<BR>";
it won't work.. how do you get associative array names like these MIN() and MAX() displayed?
Thanks in advance for the help..
Comment