Page is a not externally linkable
Marked - 3:26 am on Feb 9, 2010 (gmt 0)
CyBerAliEn, thank you for all your hard work and the effort you put into your post. I really do appreciate the time you spent trying to help me.
I am really pleased that I got this to work, bedlam was correct and the unserialize function gave me the array to work with. Although I needed an extra function in there.
Here's what I used:
function max_key($array) {
foreach ($array as $key => $val) {
if ($val == max($array)) {
return $key;
}
}
}
$winner_id = max_key($poll_data[1]['votes']);
$poll_winner = $poll_data[1]['choice'][$winner_id];
This is actually going to be a module on the homepage which automatically displays the winner of a member of the month contest we have on the forums. When the topic with the poll is closed, the code we have discussed here will be run and the winners username will show up. Now what I'm going to do is query the members table for the username that matches the winner from the poll(the choice) so the winner members avatar will displayed as well as a link to their profile.
Thanks again for the help guys. I am really happy I got this working.