vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Ranking Dropdowns (non-duplicates) (https://vborg.vbsupport.ru/showthread.php?t=170022)

aggiefan 02-09-2008 03:17 AM

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?

MoT3rror 02-09-2008 03:29 AM

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']++; 


aggiefan 02-09-2008 03:34 AM

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.

MoT3rror 02-09-2008 03:49 AM

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.

aggiefan 02-09-2008 04:58 AM

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.

MoT3rror 02-09-2008 05:36 PM

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




All times are GMT. The time now is 06:15 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02215 seconds
  • Memory Usage 1,730KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete