mysql_fetch_array - Where's my data?

When I sendAndLoad this in Flash, the php isn’t returning my values. The code below returns Q7 for the $line value. I’ve tried $line[1], $line[0][1], $line[‘Q7’] and I can’t get my data. I’ve check the data in my phpmyadmin and the values are there. What am I doing wrong?


$query = "SELECT 'Q7' FROM Votes";

$results = @mysql_query($query);

echo "<?xml version=\"1.0\"?>
";

while($line = mysql_fetch_array($results,MYSQL_BOTH)){
echo "<results line='".$line[0]."' />
";
}

$query = “SELECT Q7 FROM Votes”;

$results = mysql_query($query) or die(mysql_error());

echo “<?xml version=“1.0”?>
”;

while($line = mysql_fetch_array($results)){
echo “<results line=’”.$line[0]."’ />
";
}

Let me know if that produces any errors.

I’m not getting errors. I’m still getting the ‘Q7’ value returned instead of the data in the row.

Do you have a column named Q7? If you do something like “SELECT 0 FROM tblName” then if you have 100 rows returned, you’ll get 0 in all rows returned.

sstalder is correct, as he removed quotes from Q7 (if you have a column named Q7). Otherwise, you’ll get errors.