PDA

View Full Version : Working on poll hack - need quick help


assassingod
07-06-2003, 08:51 AM
Hey;

I need some help with a new poll hack im working on.

If someone would kindly explain how to show which option a user voted for in a poll (like display a template)

Here is my current code;


$uservoteinfo=$DB_site->query_first("SELECT userid FROM pollvote WHERE userid=$bbuserinfo[userid] AND pollid='$pollid'");
if ($uservoteinfo[userid]==$bbuserinfo[userid]) {
eval("\$usesrvoteinfo = \"".gettemplate("poll_usersvoteinfo")."\";");
} else {
$usersvoteinfo = '';
}


It doesn't work, and I didn't think it would when I used it, but I tried it anyway.

I know vB3 does this by displaying a * next to option, but I need something like that for vB2:D

Thanks.

Dean C
07-06-2003, 02:56 PM
Take a look at the code in admin/thread.php :)

- miSt

assassingod
07-06-2003, 03:38 PM
I've taken a quick look at thread.php it was the first file I looked at. I didn't find anything relavent, but if you think there is, would you mind showing me?:D

noppid
07-08-2003, 06:44 PM
This is not tested, but should give ya the idea...


$uservoteinfo=$DB_site->query_first("SELECT userid,voteoption FROM pollvote WHERE userid=$bbuserinfo[userid] AND pollid='$pollid'");
if ($uservoteinfo[userid]==$bbuserinfo[userid]) {
$options=$DB_site->query_first("SELECT options FROM poll WHERE pollid='$pollid'");
$poption=explode("|||",$options['options']);
$opnum=intval($uservoteinfo['voteoption']) - 1;
$yourvote="You voted for " . $poption[$opnum];
} else {
$yourvote = '';
}

assassingod
07-10-2003, 07:30 PM
Thanks for that noppid, but after using the original code and tweaked code, it didn't work.

noppid
07-10-2003, 07:35 PM
The code has to be close, I'll give it a whirl on my board later.

assassingod
07-10-2003, 07:37 PM
Thanks, i'll have another look through it as well.

Thanks again:)

assassingod
07-12-2003, 07:44 PM
Thanks for you help, but i've got it now;)