First, is ‘value’ the name of a column if your database? Does it actually have data in that column in a row? Seeing your database structure would be helpful.
Second, because “while” is a loop, it will rewrite the value of “$row[‘value’]” each time it repeats. If the value of “value” for the last row is empty, your variable will be empty. Additionally, typing $row[‘value’] anywhere below your loop will only return the value of the LAST row returned in your results.
Third, how many rows are returned?
Fourth, doing $row[‘value’] = $value will set $row[‘value’] to equal whatever $value equals - which I’m guessing is nothing at this point. If should be flipped. $value = $row[‘value’]. However, $value will still only be equal to the ‘value’ column of the LAST row returned.
Do this:
while ($row = mysql_fetch_array($result)) {
print_r($row['value']);
}
What does that output?
I suspect you only need to do mysql_fetch_assoc, instead of mysql_fetch_array - which returns both numerical and associative arrays.
What you are doing is the equivelent of creating a variable called $3.154 when infact you should be creating a variable called $pie and assigning it a value of $3.154. While it will work, it makes accessing the variable very difficult as you wont know what its name is going to be.
PHPycho: i quoted your post as the code was more correct, I appreciate the original html came from the OP.