booking calender code (like flight booking)

Associate
Joined
30 Dec 2007
Posts
2,054
Location
Oxonfordshire
Hi, basically im trying to make a website for the bike shop i work at so that people can book our hire bike's online. I have a php databasewhich i want the calender to pull and give information to. However im very new to this and dont have the experience to write something like this myself, if somebody knows of some free code that has already been written to do this and is freeware, could you please post it up, or a link to the site.
Thanks sam
 
Last edited:
ok that looks really good and i like how it brings up the calender, the colour scheme is also perfect for my site, i may not have quite explained well enough what i need though, i need it to work like a booking calender on a flight website like easy jet, you take two dates and then it fills my dtabase saying that all the dates between the 2 chosen are now reserved and you cannot now reserve that bike for any of those dates, as i9 said im using a php database to do this.

cheers sam
 
Last edited:
Woah, woah, woah...

You really need to think about what your doing here. Your creating a booking system for a client and they are going to have much more requirements than just hiring a bike between two dates. Your going to have create a backend that can access and modify these bookings as well as presumably handle bookings at the same date and time for multiple bikes that you can hire out. In addition think how are you going to handle cancellations etc.

In my opinion this isn't something you can do from scratch, for a production environment, without knowing what you're doing. You get this wrong and your loosing the company business or worse still, for small companies, giving them a bad reputation that they aren't flexible or reliable.

As for finding software that's going to do this for you (as in front end and back end) I'd highly recommend looking at getting your website running on a free CMS, like WordPress and looking for a plugin that gives you the functionality you need on top of that.

http://wordpress.org/
http://wordpress.org/extend/plugins/booking/

In addition it will probably help you looking for prebuilt software if you get your terminology right. You'll be looking for software that's written in PHP and uses an SQL Database if you don't want to go down the Wordpress route.

Sorry if that comes across quite negative but just want you to realise what you're getting into.

Roy
 
hi thanks for the advice, this is actually fro my A2 computing project in which you have to make something fro a client, this being the shop were i work at, i have talked a lot at length with my teacher about how to build this program and do have a good idea of how its going to work, i can understand how it wouldnt seem like that from wht i worte above, i already have a admin page which you will be able to delete/add or find records in the database and i have a rough idea of how i could do the booking part it just wouldnt be very user freindly and i want it to be as easy to use as possible. as you so its the companys reputation at stake here.

thanks sam
 
Last edited:
Ah right, in which case that's different :)

However, watch your expectations of what your trying to achieve here. Your coursework is going to have strict time limitations and what will likely give you a very high pass mark, for an A2 project, wont necessarily meet the high expectations and flexibility that your shop will require.

If it's anything like i remember my highers being your likely going to have enough time to really focus on one aspect of this project. Being a computing course at this level your likely going to get more marks for coding aspect and just getting something working over the functionality and design of the user interface.

Anyway, as for advise for exactly what your trying to do right now:

I think the piece of advise that's going to get you working in the right direction is that you don't need all the dates in between on another. For a booking you need a start date and an end date. You should then be able to create a query that says "are there any bookings on this date" that checks no other bookings start before said date and end after said date.

Also, the fact that your looking at a calendar control for this again makes me a bit concerned, but correct me if I'm wrong. Shouldn't bookings for bikes also allow you to select the time for the booking? Like book for 4 hours or something? You should be able to find controls that combine both date and time in one control then you'd just put that value straight into the database. Again, suppose it just comes down to the design.

Still, my advise for you at the moment, focus on having a textbox that let's you get a booking date in a format you expect THEN look at adding a calendar on top of your tested booking code.

Also, good luck :)

Roy
 
hi, can i just point out that there are 2 people on this acount at the moment. I told Sam to use my account as ocuk is very good on advice.

Ali - owner of account !
Sam - asking all the questions and at school.

Sam if your reading this please put your name at bottom of each post, and check your spelling its terrible !!

thanks Roy for the replys

Ali

edit: might be worth Sam registering for an account as ocuk forums are the best!
http://forums.overclockers.co.uk/register.php
 
Last edited:
RoyM16

thats exactly what i wanted to do in the first place, write some code so that when a customer books a bike for hire it checks that they date they entered and the dates betwwen does not overlap with any other already in the database, the problem is with what i already now i cant think how to do that (in php) im fairly sure i could write it in some other languages but nothing web based. do you have any advice on hwo i could write it in php? i can give you the url to my database if you wanted to have a look at it.

thanks
 
Hey Sam,

Let me just start from the beginning and put down the basic steps you'll need to preform. Hopefully it will cover what you're asking.

1) Take the start date and end date of the booking from the customer
2) Customer presses book button that calls a function that will check the dates with a PHP function
3) PHP function calls a SQL query (or stored procedure) to the database to check that those dates are free
4) The SQL query takes the start date and the end date and checks that there are no other bookings that will conflict with those dates.
5) Your SQL query will likely return no rows if the dates are free and if the dates are not free it will likely return a row
6) Your PHP function should look at the response of the SQL query and return "true" or "false" saying whether those dates are free
7) If it is free then you should write some PHP code that creates some SQL that will add your new booking to your database and tell the user.
8) If it's not free then return an error
9) Done.

I suppose to answer you question specifically you need to realise that checking the dates are free and writing your new booking to the database will be two separate steps and that regardless of previous programming knowledge you will be using SQL to check the dates are free and SQL to write the booking to the database.

The only bit of real PHP you'll have to learn is "How do I make PHP call the SQL that I have written that checks the booking dates are ok"

In which case you'll be looking for this:
http://php.net/manual/en/function.mysql-query.php

Let us know how you get on.

EDIT:: I've just realised that from the way you word the question you might not have ever used SQL to really work with a database before and something like this you may have done programmatically in the past. If this is the case then let us know.

Roy
 
Last edited:
Back
Top Bottom