Thankfully, MinnesotaPlaylist provides...
';
$key = 'like';
$nid = '9066';
$sql = "select count(a) from {survey10} where q='%s' and uid=%d";
$count = db_result(db_query($sql, $key, $user->uid));
if (isset($_POST['submit']) && ($_POST['flag_id']==$nid)) {
for ($i=1; $i<=13; $i++) {
if (!empty($_POST[$i])) {
if (($i == 13) && (!empty($_POST['other']))) {
$sql = "insert into {survey10} (uid, q, a, other) values (%d, '%s', '%s', '%s')";
db_query($sql, $user->uid, $key, $_POST[$i], $_POST['other']);
} else {
$sql = "insert into {survey10} (uid, q, a) values (%d, '%s', '%s')";
db_query($sql, $user->uid, $key, $_POST[$i]);
}
}
}
print 'Thanks for taking our survey. Your answer has been included in the results below.';
} else {
if ($user->uid) {
if ($count == 0) {
?>
'Other' responses:
- ";
while ($data = db_fetch_object($result)) {
print '
- ' . $data->other . ' (' . $data->count_other . ') '; } print '