View Full Version : help. please... booking system.

11-22-2007, 08:56 AM
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.

11-22-2007, 11:32 PM
what exactly have you got and what do you need?

11-23-2007, 12:21 AM
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.


11-23-2007, 08:50 AM
show us what you have currently

11-23-2007, 09:00 AM
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:

$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 = 0;
if (!$error){
$new_array = $sample_array;
while ($counter < $day_end){
$new_array[$counter] = 1;
} 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.

11-23-2007, 09:15 AM
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