Thanks for your vote! Your feedback helps us make certain Spark brings you more of what you need. Here are some voting results. If you feel really strongly about your choice, you can vote again in as little as 30 minutes.

function _spark_vote_print_results($cid) {
$nid = 248954;

$name_sql = "SELECT extra FROM webform_component " .
"WHERE nid = %d AND cid = %d";
$name_result = db_fetch_object(db_query($name_sql, $nid, $cid));
$name_data = unserialize($name_result->extra);
$name_data = $name_data['items'];
$name_data = explode("\n", $name_data);
$names = array();
foreach ($name_data as $name) {
$names[substr($name, 0, strpos($name, '|'))] = substr($name, strpos($name, '|')+1);
}

$choices = array();
$writeins = array();

$sql = "SELECT data, COUNT(data) AS count " .
"FROM webform_submitted_data " .
"WHERE nid = %d AND cid = %d AND data != ''" .
"GROUP BY data " .
"ORDER BY count DESC";
// "LIMIT 3";
$results = db_query($sql, $nid, $cid);
while ($result = db_fetch_object($results)) {
// If an actual choice
if (isset($names[$result->data])) {
$choices[] = $names[$result->data];
}
else {
$writeins[] = $result->data;
}
}

echo "Top Three Choices:
";
echo "

    ";
    for ($i=0; $i echo "
  1. " . (array_key_exists($i, $choices) ? $choices[$i] : '?') . "
  2. ";
    }
    echo "

";
echo "
";

echo "Top Write-in:
";
echo "

    ";
    for ($i=0; $i echo "
  1. " . (array_key_exists($i, $writeins) ? $writeins[$i] : '?') . "
  2. ";
    }
    echo "

";
}

_spark_vote_print_results(1);
?>

Last Updated: Mar 13, 2016

Comments