SitePoint Sponsor

User Tag List

Results 1 to 11 of 11
  1. #1
    Your daddy. WALoeIII's Avatar
    Join Date
    Apr 2001
    Location
    USA
    Posts
    526
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    first come first serve sign-up page

    I'm doing a website for my gaming clan, and I'm trying to build a script to automate the adding of matches and outcome. I want it so only the first 8 people can sign-up. And then for it to say the match is full. How can I do this? should I creat 8 spots in the table?

    I know how to count the number of entries, but well, I don't know where to get started.

  2. #2
    SitePoint Member
    Join Date
    Sep 2001
    Location
    Maryland
    Posts
    20
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you know how to count the number of entries, you can just make a conditional statement, if the number of entries is less than 8, let them sign up, otherwise, don't.

    HTH
    jogler

  3. #3
    Your daddy. WALoeIII's Avatar
    Join Date
    Apr 2001
    Location
    USA
    Posts
    526
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    but what would I count the number of entries of? I don't want to create a new table for every match!

  4. #4
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    this might not be the most efficient method, but when someone signs up, have it open a file that contains a number.
    0 when no one has signed up.
    each time someone signs up, increase the number by one, and when it equals 8, make it print a message saying signups are full.

    or you could do this with a new table, which would be MUCH easier, but you didn't want to create another table
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  5. #5
    Your daddy. WALoeIII's Avatar
    Join Date
    Apr 2001
    Location
    USA
    Posts
    526
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The problem is we have a match once a week, and I want the first 8 guys to sign up to be the ones that play. And if I have to create a new table every time thats gonna be ALOT of tables. I think I'll try that though.

  6. #6
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Have one table that will hold all of the match data. Have one field to hold a unique id for the match then when people sign up for a match count how many entries there are with that id. If it is not 8 you can add them to the table else say the match is full.

    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature

  7. #7
    Your daddy. WALoeIII's Avatar
    Join Date
    Apr 2001
    Location
    USA
    Posts
    526
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hey! good idea, I already have the match_id that auto increments, but I don't get how you would set it up to count?

  8. #8
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The basics of it will be something like this:

    PHP Code:
        $MID 12;

        
    $sql mysql_query("SELECT count(*) FROM matches WHERE MatchID = '$MID'") or die(mysql_error());

        
    $count mysql_result($sql00);

        if ( 
    $count ) {

            
    $places $count;

            echo 
    "$places place(s) left";

        } else {

            echo 
    "No places left";

        } 
    $MID is a variable that represents the match id

    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature

  9. #9
    Your daddy. WALoeIII's Avatar
    Join Date
    Apr 2001
    Location
    USA
    Posts
    526
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The probem with that is that I'd be counting the total number of matches, I need to be able to count the number of entries in a single column of a table. So in the colums players (just as an example) I would be able to insert people into that colum, but I'd like to count the number of people that are in that particular column. I don't understand what good it would to to count all of the entries in my table, that would just give me the first 8 people to sing up ever, I will not be clearing the table each round, I want to store the data of each row, and then start a new row for each and every match. And within each row have a space for people to sign up. Should I maybe create 8 new columns slot1-8 or something and insert into each column? or is there a way to put all 8 players into 1 column called players. I could potentially maniupulate my columns with a for clause... Here's my table so far, with an example of the data I'd like to have entered.

    Code:
    CREATE TABLE `ladder` (
      `match_id` int(4) NOT NULL auto_increment,
      `opponent` varchar(255) default NULL,
      `tag` varchar(255) default NULL,
      `ladder` varchar(255) default NULL,
      `map` varchar(255) default NULL,
      `time` varchar(255) default NULL,
      `location` varchar(255) default NULL,
      `outcome` varchar(255) default NULL,
    ?? what should I do for the players in the match?
      PRIMARY KEY  (`match_id`)
    I've already made a simple script to let me add/edit/delete matches based of the match_id variable. I am going to make a separate script that will allow people to signup to play in a particular match (ie those that are still not filled.) and if there are 8 signed up for the match they won't be allowed to signup

  10. #10
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What I am suggesting is that you have a seperate matches table where each play that signs up for a match is put in that table along with the match id

    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature

  11. #11
    Your daddy. WALoeIII's Avatar
    Join Date
    Apr 2001
    Location
    USA
    Posts
    526
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    AHHHH!!! I'm sorry some how I wasn't getting that. LOL! Thanks that will work perfectly, and I'll keep my data nice and normalized. LOL! Thanks


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •