Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11
  1. #1
    Junior Member
    Join Date
    Oct 2003
    Posts
    5
    Member #
    3437
    I am trying to create a tee time reservation script.
    I have already created a login system for golf course members, but now I am stuck trying to figure out how to schedule a time and hole for each member.

    I need some help to figure out how I will setup the table in the mysql and how to send the values from the php form into the fields.

    I also need to know how to view teetimes day by day.

    I need some help getting started with some example code please.

    Here is a temporary log in name and password to the site so you can see what I mean
    http://www.okeechobeegolf.com/member...user/index.php
    user: 11
    pass: 22

  2.  

  3. #2
    JR
    JR is offline
    Senior Member JR's Avatar
    Join Date
    Nov 2002
    Location
    UK
    Posts
    4,354
    Member #
    257
    Ok I can see a problem with this already:

    What if a user wants to start at hole #1 at 7.15 and another member wants to start at hole #2 at 7.30? - there would be a clash.

    I would personally use a template page, and have a timestamp in a url variable, then use timestamps a lot. It would be too complicated for me to explain, but if you are having problems I will create a simple one for you to look at probably tommorow.
    JR

  4. #3
    Junior Member
    Join Date
    Oct 2003
    Posts
    5
    Member #
    3437
    Simple Reservation System

    Thank you for your comment, please show me an example tomorrow how this would work.

  5. #4
    Senior Member justlivyalife's Avatar
    Join Date
    Jul 2003
    Location
    Birmingham, UK
    Posts
    2,871
    Member #
    2374
    "Each player is only allowed to be at a hole for 10 minutes before the next player gets there."
    With my (very limited) experience of golf, I would think that ten minutes is not long enough to tee off. I'm not sure though. I can see your problem, but am unable to help at the moment, I'm sure JR will help you.
    justlivyalife - The future depends on what we do in the present. (Mahatma Gandhi)
    WDF Resources: WDF Rules
    Non-WDF: JavascriptSource | Dynamic Drive | phpBB | HTML-Kit | Winamp | Download Firefox | Morguefile

  6. #5
    JR
    JR is offline
    Senior Member JR's Avatar
    Join Date
    Nov 2002
    Location
    UK
    Posts
    4,354
    Member #
    257
    Ok, after thinking about it I decided this is too complex for me to make a simple example.

    Here is what I would do though

    Obviously you have your user table, I would set up a tee off table like so:

    TEE_TIMES(ttid, userid, hole, players)

    ttid is the primary key, and it would contain timestamps.

    Then I would have a tee_times page with a url variable for the date as a timestamp. Then I would load the page's content using this timestamp (i.e. add 900 onto the timestamp for each time (because 900 is 15 minutes)). You could convert the timestamp in the url into a date and therefore the title of the page. You would have to remember to add 25200 to the url timestamp because it starts at 7 and 25200 is 7 hours in seconds.

    Then there would be a table with the forms for the number of players you would want to book and the hole you would want to start at, here is an example:

    PHP Code:
    <form action="processtime.php?tid=<?php $tid 900 ?>&uid=<?php $userid ?>" method="post" name="0700">
    <!-- Number of people box !-->
    <!-- Starting hole box !-->
    <!-- Submit Button !-->
    </form>
    <form action="processtime.php?tid=<?php $tid 1800 ?>&uid=<?php $userid ?>" method="post" name="0715">
    <!-- Number of people box !-->
    <!-- Starting hole box !-->
    <!-- Submit Button !-->
    </form>
    The forms would then be sent to a process page where a database insert query is built using 2 url variables (1. the userid from your login script and 2. the timestamp which is obtained from the url variable of the tee times page and has the specific time in seconds added to it). You could create the list of times using a for loop and have multiples of 15 minutes in seconds (900) added to the timestamp each time.

    You would then have a link on the bottom of the page to go to the next day, with 24 hours in seconds (86400) added to the timestamp:

    PHP Code:
    <a href="teetimes.php?tid=<?php $tid 86400 ?>
    That is how I would start it off, but you have a lot of things to consider such as clashes and informing the members what time has been booked (I would do this by running a db query to check for each timestamp and then add text saying this time has been booked instead of the form) And of course some member may decide to edit the timestamp in the url and it would screw it up, so maybe sessions would be better.

    I am really crap at explaining things so I apologize, this is probably a record for my worst explanation on this forum. Even if you were the world master of PHP I don't think you would understand this very well
    JR

  7. #6
    Senior Member mossoi's Avatar
    Join Date
    Apr 2003
    Location
    Englandshire, United Kingdomsville y'all!
    Posts
    1,111
    Member #
    1206
    Liked
    1 times
    Just a quick query, why would you have tee reservation times for holes throughout the course? I don't see any time when somebody would book to be on the 3rd tee at 2pm for example.

    Wouldn't the best method be to work out the average time for a full round (possibly based around variables such as weather) and only allow reservations on the 1st tee to start the round.

    You could maybe expand this to allow people to play front or back nine only but I can't see how it would work if people were expected on a specific tee at a specific time.

  8. #7
    Junior Member
    Join Date
    Oct 2003
    Posts
    5
    Member #
    3437
    Simple Reservation System

    Sorry, my weak point is mysql.
    I have done everything like you said, but I am having one problem trying to get the date and time to correspond with a member in the database.
    It seems to me that the "teeid" line is wrong somehow for putting timestamps into that field. How would I correct it?

    This is what I have curently....

    #
    # Table structure for table 'teetimes'
    #
    DROP TABLE IF EXISTS teetimes;
    CREATE TABLE teetimes (

    teeid INT(1) UNSIGNED ZEROFILL DEFAULT '0' NOT NULL,
    member varchar(50) DEFAULT '' NOT NULL ,
    hole varchar(18) DEFAULT '' NOT NULL ,
    players varchar(50) DEFAULT '' NOT NULL,
    PRIMARY KEY (teeid)


    );

    ------------------------------------------------------
    This is how I made a select box that carries the timestamp as a variable.

    PHP Code:
    $sevenam "25200"// 7 hours; 7am
    $eightam "28800"// 8 hours; 8am
    $nineam "32400"// 9 hours; 9am
    $tenam "36000"// 10 hours; 10am
    $elevenam "39600"// 11 hours; 11am
    $twelvepm "43200"// 12 hours; 12pm
    $onepm "46800"// 13 hours; 1pm
    $twopm "50400"// 14 hours; 2pm
    $threepm "54000"// 15 hours; 3pm
    $fourpm "57600"// 16 hours; 4pm
    $fivepm "61200"// 17 hours; 5pm
    $sixpm "64800"// 18 hours; 6pm
    $sevenpm "68400"// 19 hours; 7pm 
    <select size="1" name="time">
    <option value="<? $sevenam ?>">7:00 am</option>
    <option value="<? $sevenam + 600 ?>">7:10 am</option>
    <option value="<? $sevenam + 1200 ?>">7:20 am</option>
    <option value="<? $sevenam + 1800 ?>">7:30 am</option>
    <option value="<? $sevenam + 2400 ?>">7:40 am</option>
    <option value="<? $sevenam + 3000 ?>">7:50 am</option>
    <option value="<? $eightam ?>">8:00 am</option>
    <option value="<? $eightam + 600 ?>">8:10 am</option>
    <option value="<? $eightam + 1200 ?>">8:20 am</option>
    <option value="<? $eightam + 1800 ?>">8:30 am</option>
    <option value="<? $eightam + 2400 ?>">8:40 am</option>
    <option value="<? $eightam + 3000 ?>">8:50 am</option>
    <option value="<? $nineam ?>">9:00 am</option>
    <option value="<? $nineam + 600 ?>">9:10 am</option>
    <option value="<? $nineam + 1200 ?>">9:20 am</option>
    <option value="<? $nineam + 1800 ?>">9:30 am</option>
    <option value="<? $nineam + 2400 ?>">9:40 am</option>
    <option value="<? $nineam + 3000 ?>">9:50 am</option>
    <option value="<? $tenam ?>">10:00 am</option>
    <option value="<? $tenam + 600 ?>">10:10 am</option>
    <option value="<? $tenam + 1200 ?>">10:20 am</option>
    <option value="<? $tenam + 1800 ?>">10:30 am</option>
    <option value="<? $tenam + 2400 ?>">10:40 am</option>
    <option value="<? $tenam + 3000 ?>">10:50 am</option>
    <option value="<? $elevenam ?>">11:00 am</option>
    <option value="<? $elevenam + 600 ?>">11:10 am</option>
    <option value="<? $elevenam + 1200 ?>">11:20 am</option>
    <option value="<? $elevenam + 1800 ?>">11:30 am</option>
    <option value="<? $elevenam + 2400 ?>">11:40 am</option>
    <option value="<? $elevenam + 3000 ?>">11:50 am</option>
    <option value="<? $twelvepm ?>">12:00 pm</option>
    <option value="<? $twelvepm + 600 ?>">12:10 pm</option>
    <option value="<? $twelvepm + 1200 ?>">12:20 pm</option>
    <option value="<? $twelvepm + 1800 ?>">12:30 pm</option>
    <option value="<? $twelvepm + 2400 ?>">12:40 pm</option>
    <option value="<? $twelvepm + 3000 ?>">12:50 pm</option>
    <option value="<? $onepm ?>">1:00 pm</option>
    <option value="<? $onepm + 600 ?>">1:10 pm</option>
    <option value="<? $onepm + 1200 ?>">1:20 pm</option>
    <option value="<? $onepm + 1800 ?>">1:30 pm</option>
    <option value="<? $onepm + 2400 ?>">1:40 pm</option>
    <option value="<? $onepm + 3000 ?>">1:50 pm</option>
    <option value="<? $twopm ?>">2:00 pm</option>
    <option value="<? $twopm + 600 ?>">2:10 pm</option>
    <option value="<? $twopm + 1200 ?>">2:20 pm</option>
    <option value="<? $twopm + 1800 ?>">2:30 pm</option>
    <option value="<? $twopm + 2400 ?>">2:40 pm</option>
    <option value="<? $twopm + 3000 ?>">2:50 pm</option>
    <option value="<? $threepm ?>">3:00 pm</option>
    <option value="<? $threepm + 600 ?>">3:10 pm</option>
    <option value="<? $threepm + 1200 ?>">3:20 pm</option>
    <option value="<? $threepm + 1800 ?>">3:30 pm</option>
    <option value="<? $threepm + 2400 ?>">3:40 pm</option>
    <option value="<? $threepm + 3000 ?>">3:50 pm</option>
    <option value="<? $fourpm ?>">4:00 pm</option>
    <option value="<? $fourpm + 600 ?>">4:10 pm</option>
    <option value="<? $fourpm + 1200 ?>">4:20 pm</option>
    <option value="<? $fourpm + 1800 ?>">4:30 pm</option>
    <option value="<? $fourpm + 2400 ?>">4:40 pm</option>
    <option value="<? $fourpm + 3000 ?>">4:50 pm</option>
    <option value="<? $fivepm ?>">5:00 pm</option>
    <option value="<? $fivepm + 600 ?>">5:10 pm</option>
    <option value="<? $fivepm + 1200 ?>">5:20 pm</option>
    <option value="<? $fivepm + 1800 ?>">5:30 pm</option>
    <option value="<? $fivepm + 2400 ?>">5:40 pm</option>
    <option value="<? $fivepm + 3000 ?>">5:50 pm</option>
    <option value="<? $sixpm ?>">6:00 pm</option>
    </select>

  9. #8
    JR
    JR is offline
    Senior Member JR's Avatar
    Join Date
    Nov 2002
    Location
    UK
    Posts
    4,354
    Member #
    257
    Does your login script store the id of the member in a session? If so then you would get the member from there.

    For example if the variable was called $memid it would be something like this:

    PHP Code:
    $query "INSERT into `teetimes` 
                (
                    `teeid`,
                    `member`,
                    `hole`,
                    `players`
                )
                VALUES
                (
                    '
    $ttid',
                    '
    $memid',
                    '
    $hole',
                    '
    $players'
                )"
    ;
                
    $insert mysql_query($query)
            or die(
    '<pre><b>Error: </b>' mysql_error() . '</pre>'); 
    Regarding your question about the teeid, I would allow about 10-20 numbers (I can't remember how long timestamps are).

    Also, remember to add the numbers you have for each hour onto the timestamp for midnight of the date that is being viewed.

    I hope this has answered your question.
    JR

  10. #9
    Junior Member
    Join Date
    Oct 2003
    Posts
    5
    Member #
    3437
    Allright sorry its been awhile, but check it out now! I used your advice and hit the manuals hard. Its not ready for production use. I need to make it more robust, full of features. But at least I got the mysql part of it down good i think.

    -Ray

  11. #10
    Junior Member
    Join Date
    Oct 2003
    Posts
    5
    Member #
    3437
    Oh yes, and by the way I do use sessions, you can see it if you disable cookies in your browser.


Page 1 of 2 1 2 LastLast

Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 09:14 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com