Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 02-09-2008, 03:17 AM
aggiefan aggiefan is offline
 
Join Date: Apr 2005
Posts: 169
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Ranking Dropdowns (non-duplicates)

What I'm trying to do is have the user rank from 1-25 (or something like that) a list of items. I don't want the numbers to be repeated, so there needs to be some kind of validation to where it removes or changes the selection if you pick/type a duplicate.

Are dropdowns the easiest way to go here? If so, i haven't found anywhere how to accomplish this. Can anybody point me in the right direction or give me some advice on how to accomplish this?
Reply With Quote
  #2  
Old 02-09-2008, 03:29 AM
MoT3rror MoT3rror is offline
 
Join Date: Mar 2007
Posts: 423
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

When I made a ranking system for a ladder system, I used this code.
PHP Code:
$rank + ($perpage $pagenumber);
while(
$clans $db->query_read($clan_query))
{
$rank++; 
// ...

I found this was the easiest way to keep a update ranking system without storing it in the database and updating every hour, day, etc.

Then when I wanted to get it for a individual clan, I used this code
PHP Code:
$rankcount $db->query_first("SELECT COUNT(column) AS 'count' FROM clans WHERE exp > $clanexp");

$rank $rankcount['count']++; 
Reply With Quote
  #3  
Old 02-09-2008, 03:34 AM
aggiefan aggiefan is offline
 
Join Date: Apr 2005
Posts: 169
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for the quick reply. I'm however, looking to commit the value (eventually) to the database (and am using it on a form). My intention is to use it in the VBContest hack I created.

It is a pick 'em contest for sports. What I want to have is "confidence" ranking where you just don't pick the winner of each game, you pick the winner and assign a confidence value (1-20). If you win, you get that value. If you lose, you get zero. Adds another dimension to the game.

If you do ESPN Bowl Pick 'Em -- it's just like that.
Reply With Quote
  #4  
Old 02-09-2008, 03:49 AM
MoT3rror MoT3rror is offline
 
Join Date: Mar 2007
Posts: 423
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You can have a column in like your user table called confidence_points. This column will hold the points they have gain total. When a user goes to assign a confidence value, the game id(if are you wanting to use it or you can use a different way to tell games part) and the value is stored in a new table. When the game is finished/reported into system, the system will then find all the users that guess correct and add the points to the column confidence_points.

Then a query like this can determine who has the most points.
[SQL]
SELECT * FROM users ORDER BY confidence_points + 0 DESC LIMIT 30
[/SQL]

There is still a lot to fill in the system but that should get you the basic ranking system.

Sorry I never played ESPN Bowl Pick 'Em but this my understanding of their system after a quick look through.
Reply With Quote
  #5  
Old 02-09-2008, 04:58 AM
aggiefan aggiefan is offline
 
Join Date: Apr 2005
Posts: 169
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

For example:

On the entry form, we list 20 games (Texas vs Texas A&M, etc). They pick a winner, then in another field, rank it in confidence 1-20.

I need a way to make sure they don't duplicate the ranking in more than one game. That's what I'm looking for. I don't want them to be able to put Texas A&M as 18 and Michigan as 18.
Reply With Quote
  #6  
Old 02-09-2008, 05:36 PM
MoT3rror MoT3rror is offline
 
Join Date: Mar 2007
Posts: 423
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You can have a table like this.
[SQL]
CREATE TABLE `games` (
`gameid` int(10) NOT NULL auto_increment,
`week` mediumint(5) NOT NULL default '0',
`hometeam` varchar(255) NOT NULL default '',
`visitingteam` varchar(255) NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=0 ;[/SQL]
Then a table like this.
[SQL]
CREATE TABLE `confidence_choices` (
`gameid` int(10) NOT NULL auto_increment,
`userid` int(10) NOT NULL default '0',
`week` mediumint(5) NOT NULL default '0',
`confidence_points` mediumint(2) NOT NULL defaut '0'
)ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=0;
[/SQL]

Then when they send in their confidence points, you just run a query like this.
PHP Code:
$check_confidence $db->query_first("SELECT COUNT(gameid) AS 'count' FROM confidence_choices WHERE week = $week AND confidence_points = $confidece_point");

if(
$check_confidence['count'] == 0)
{
//User hasn't submit value
}
else
{
//User has submit value, show error message

Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:33 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06127 seconds
  • Memory Usage 2,217KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete