A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Display Available Times vs selected time

  1. #1
    It's a long way to the middle launchpad67's Avatar
    Join Date
    Oct 2004
    Location
    Prescott, Arizona
    Posts
    1,387

    Display Available Times vs selected time

    I'm working on another reservation system and I would like to display the "available times" if the time the user has picked is Not available. (Like an airline reservation system)

    I have a query that works fine for determining if the time is full but I would like to show the available times for that given date.

    Here's my current query:

    PHP Code:
    $sql " SELECT * FROM `yppentries` WHERE `time` = '$time' AND `resdate` = '$resdate' "
       
    $result mysql_query($sql) or die("<font color='#000000'>Query failed: $sql - " mysql_error()); 
       
    $entries mysql_num_rows($result); 
    if (
    $entries <=1) {     
        echo 
    "<center><font color=green size=4><b>&gt; $_POST[time] is Available on $_POST[month]-$_POST[day]-$_POST[year] !! &lt;</b>"
    } else { 
        echo 
    "<center><font color='#ff0000'><b>Sorry, but the Time on $resdate you selected is not available!<br />Please pick another time and try again<br />"
    ##### Query to find what times Are available for the selected date ##### 
    ### Insert next Query here ### 


    The times available for any date are: 11:00, 11:30, 2:00, 2:30, 5:00, 5:30
    Each time is available twice per day. Meaning there are 2 - 11:00 slots and 2 - 11:30 slots, ect...

    So, I need to subtract the selected time from all the available times and run a new query to display the results within the last else echo statement.

    I could probably make another db table and setup reference rows but I think I can do this with just another query instead.

    Thanks for any help,

  2. #2
    Senior Member
    Join Date
    Apr 2007
    Posts
    161
    Quote Originally Posted by launchpad67
    I'm working on another reservation system and I would like to display the "available times" if the time the user has picked is Not available. (Like an airline reservation system)

    I have a query that works fine for determining if the time is full but I would like to show the available times for that given date.

    Here's my current query:

    PHP Code:
    $sql " SELECT * FROM `yppentries` WHERE `time` = '$time' AND `resdate` = '$resdate' "
       
    $result mysql_query($sql) or die("<font color='#000000'>Query failed: $sql - " mysql_error()); 
       
    $entries mysql_num_rows($result); 
    if (
    $entries <=1) {     
        echo 
    "<center><font color=green size=4><b>&gt; $_POST[time] is Available on $_POST[month]-$_POST[day]-$_POST[year] !! &lt;</b>"
    } else { 
        echo 
    "<center><font color='#ff0000'><b>Sorry, but the Time on $resdate you selected is not available!<br />Please pick another time and try again<br />"
    ##### Query to find what times Are available for the selected date ##### 
    ### Insert next Query here ### 


    The times available for any date are: 11:00, 11:30, 2:00, 2:30, 5:00, 5:30
    Each time is available twice per day. Meaning there are 2 - 11:00 slots and 2 - 11:30 slots, ect...

    So, I need to subtract the selected time from all the available times and run a new query to display the results within the last else echo statement.

    I could probably make another db table and setup reference rows but I think I can do this with just another query instead.

    Thanks for any help,

    if ($entries <=1) Wouldnt' this statement alone allow 2 entries
    Last edited by fasco1; 04-16-2007 at 10:01 PM.

  3. #3
    Senior Member
    Join Date
    Apr 2007
    Posts
    161
    I'm looking into the coding involved to allow days and times to be visually shown open or taken. Like an appointment book so viewers can see at a glance what time slots are open and select them. If anyone can point me in the right direction I would appreciate it.

  4. #4
    It's a long way to the middle launchpad67's Avatar
    Join Date
    Oct 2004
    Location
    Prescott, Arizona
    Posts
    1,387
    Quote Originally Posted by fasco1
    if ($entries <=1) Wouldnt' this statement alone allow 2 entries
    Yes, that's what I said in my post.
    "The times available for any date are: 11:00, 11:30, 2:00, 2:30, 5:00, 5:30
    Each time is available twice per day. Meaning there are 2 - 11:00 slots and 2 - 11:30 slots, ect..."

  5. #5
    Senior Member
    Join Date
    Apr 2007
    Posts
    161
    Initially in the second part of your posting it sounded like you were asking how to put in 2 "times" in the dbases

    I guess your looking for almost the same type of setup that I am. But I need 10 or so separate booking selections with all different times.

    I'm just getting involved in it now, I'm more familiar with flash than PHP if I could get dates to populate into flash for a two week period I may be able to figure out the rest.

    I'm figuring having two database fields that would do the main part and of course the name of the person booking the spot, If a person booked a spot by selecting a radio button, flash would send these variables to php then to mysql then disable the radio button and shade it out a little based on the return values.

    I havent really had to work with dates before and thats the first thing I would want to set up.

  6. #6
    It's a long way to the middle launchpad67's Avatar
    Join Date
    Oct 2004
    Location
    Prescott, Arizona
    Posts
    1,387
    Please.....
    I would to keep this thread conductive to the actual topic, thanks.

    Anyone have any ideas??

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center