我如何回应php数组?

I have a sql output table that looks like this:

yesSum noSum
3 2

My current code says:

$sql = "SELECT SUM(yes) AS yesSum, SUM(no) AS noSum FROM votes";
$result = mysql_query($sql);
echo [$result]

and I've tried the following after echo [$result]:

while ($result= mysql_fetch_array($votes)){
echo "$votes[id], $votes[car_id]";
}
--
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
print_r($row);
}
--
foreach($results as $value){
echo $results. "<br>";
}
--
var_dump [$results];
--
var_dump ($results);

The current results just says array.

foreach($results as $value){
echo '<pre>';
print_r($value);
echo '</pre>';
}

try this

Echo the value.

foreach($results as $value){
  echo $value. "<br>";
}

Check this manual, http://php.net/manual/en/control-structures.foreach.php

You cannot use echo on an array. You have to iterate through the contents of the array and print value at each index

Try this

$sql = "SELECT SUM(yes) AS yesSum, SUM(no) AS noSum FROM votes";
$result = mysql_query($sql);
foreach($results as $value)
{
  print_r($value);
}