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