Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Regular Coder
    Join Date
    Sep 2007
    Location
    Grahamstown, South Africa
    Posts
    237
    Thanks
    6
    Thanked 17 Times in 17 Posts

    help. please... booking system.

    Hey people, Im in dire straits....

    I just wrote an incredibly complicated bookings system for a client, it worked marvelously... implemented in a cms & everything. The problem is: I needed to allow for cross year bookings, so I tried to implement that, thinking it would be easy... think again. The whole things gone gaga. Like the absolute moron I am, I didnt save it....

    Please, does anyone have a suggestion for a script I can leech? Im desperate, ill lose my job if the presentation doesnt go off smoothly...

    I cant pay anyone, but id help anyone if they had a problem like this.

    just email me on idalatob[at]yahoo[dot]co[dot]uk

    I'll be crying in the shower if anyone needs me.

  • #2
    Senior Coder timgolding's Avatar
    Join Date
    Aug 2006
    Location
    Southampton
    Posts
    1,519
    Thanks
    114
    Thanked 110 Times in 109 Posts
    what exactly have you got and what do you need?
    You can not say you know how to do something, until you can teach it to someone else.

  • #3
    Master Coder
    Join Date
    Apr 2003
    Location
    in my house
    Posts
    5,211
    Thanks
    39
    Thanked 201 Times in 197 Posts
    Did you have it hosted on a server other than your own or that of the company you work for? You may find that they have a back up even though they don't advertise such services. I had to ask for that one time before and I was fortunate, even though it wasn't as critical an applicaiton or scenario as yours sounds.

    sorry I can't be of more help.

    bazz

  • #4
    New Coder
    Join Date
    Apr 2007
    Posts
    89
    Thanks
    1
    Thanked 2 Times in 2 Posts
    show us what you have currently

  • #5
    Regular Coder
    Join Date
    Sep 2007
    Location
    Grahamstown, South Africa
    Posts
    237
    Thanks
    6
    Thanked 17 Times in 17 Posts

    Relief

    well, this is how it worked. Its not very robust, but theres excellent speed (in my testing evironment, and less strain of mysql server). And I put in good safety checks.

    each month has a string of numbers stored in the database eg (0,0,0,0,0,0) representing each day of the month. when a guy makes a booking, the string for that month (or months) is extracted and exploded into an array. I'll give you an example of it:

    PHP Code:
    $sample "0,0,0,0,0,0,0,0,0"//sample string
    $sample_array explode(",",$sample); //explodes to array
    //lets assume the guy booked from the first to the 7th of the month
    $day_start 1$day_end 7;
    $counter $day_start 1;
    while (
    $counter $day_end){ //this will be 0 to 6
            
    if ($sample_array[$counter] != 0){
                
    $error true;
            }
           
    $counter++;
    }
    $counter 0;
    if (!
    $error){
         
    $new_array $sample_array;
         while (
    $counter $day_end){
             
    $new_array[$counter] = 1;
             
    $counter++;
        }
    echo((
    implode(",",$new_array)));
    } else {
        echo(
    "Day specified is already booked");
        } 
    Obviously it is more complicated, but this is just an example. I had the following key values:
    1 - booked.
    2- first day of booking.
    3- last day of booking.
    4- Double day (means one booking ends here, and another starts)

    Also have cross month & cross year booking.

    By the way, I got it to work. But do you think this method is over complication?

    ps. I cant really show you what I have, as I have about 20 thousand lines of code or something ridiculous.
    Last edited by idalatob; 11-23-2007 at 09:02 AM.

  • #6
    New Coder
    Join Date
    Apr 2007
    Posts
    89
    Thanks
    1
    Thanked 2 Times in 2 Posts
    ok that looks good, show us the broken bit

    edit: as in your failed attempt at adding a cross year bit and also the cross month code too, I realise this code is likely to be your company proprietary work but i'm really going to need to see some juicy bits if you want me to help
    Last edited by psykx; 11-23-2007 at 09:19 AM.


  •  

    Posting Permissions

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