It hurts when I do this...
Editorial
uid));
if (isset($_POST['submit']) && ($_POST['flag_id']==$nid)) {
$sql = "insert into {survey10} (uid, q, a) values (%d, '%s', '%s')";
for ($i=1; $i<=2; $i++) {
if (!empty($_POST['other' . $i])) {
db_query($sql, $user->uid, $key . '.' . $i, $_POST['other' . $i]);
} else {
if (!empty($_POST[$i])) {
db_query($sql, $user->uid, $key . '.' . $i, $_POST[$i]);
}
}
}
print 'Thanks for taking our survey. Your answer has been included in the results below.';
} else {
if ($user->uid) {
if ($count == 0) {
?>
You have already answered this survey. Check out the results so far below.'; } } else { print ''; for ($i=1; $i = 2; $i++) { $sql = "select count(a) from {survey10} where q='%s'"; $count = db_result(db_query($sql, $key . '.' . $i)); $n=0; $word = array(); $qty = array(); $sql = "select a as word, count(uid) as qty from {survey10} where q='%s' group by word"; $result = db_query($sql, $key . '.' . $i); while($data = db_fetch_object($result)) { $word[$n] = $data->word . ' (' . 100 * (number_format($data->qty / $count, 2)) . '%)'; $qty[$n] = $data->qty; $n=$n+1; } $values = implode(',', $qty); $labels = implode('|', $word); if ($i==1) { print "
Most useful:
"; } else { print "Least useful:
"; } print ''; } ?>