Hello, i would like to know what happens at the backend(access to remote database), when someone clicks check availability on a, say an online travels, hotels, flights booking page, and he gets informations like if the rooms or flights are available on so and so dates and things.
I would be thankful if someone could atleast help me with the logic because i'm starting up a similar project. I work on PHP, javascript, html, ajax and use Postgresql.
Abie :)

Its nothing but request/response game.

If you note in case of flight. In the brouwser, in his/her pc, user chose flight, class, date of travel, then u press submit
Now that submitted parameters are send to page on the server
so server use this parameters to query database that how much seats avaialble for that particular day for that flight.

Now server sends response back to the user to his/her browser with the status.

If you book ticket same flight, date, class is updated by one seat in database. so next request will get 1 less seat now.

I'm not really sure if this is the thing you are looking for, but maybe mysql_num_rows could help you?
When you check if, as an example, a username is available, you can use the num_rows statement. If the number of rows = 0, then the username isn't in use. I think you get the point! Sorry, I'm quite new to PHP, and maybe you already know about this, but if you do not, then I'm glad I could help!

Member Avatar for diafol

The only thing you have to be aware of is concurrent users. If there are only a few places left and you're half way through a booking, it would be an amazing shame if when you get to the 'confirm' button, that it tells you 'tough luck' as somebody half way across the world was a millisecond quicker than you.

There are ways to deal with this, but you'll need to research it.

The only thing you have to be aware of is concurrent users. If there are only a few places left and you're half way through a booking, it would be an amazing shame if when you get to the 'confirm' button, that it tells you 'tough luck' as somebody half way across the world was a millisecond quicker than you.

There are ways to deal with this, but you'll need to research it.

Yes if 2 persons get same seat then one have to travel by sitting on anothers lap

Thanks for the reply guys.
@urtrivedi @diafol
Since the data is across a remote database(thats what i understand), access should be to a remote database server on another network right? So how do we even know the variable names to pass via url ?! I really hope im sounding some sense here because i haven't been able to come up with the logic!
@ckarlss0n
Once you have access to the required database, manipulation is granted. Im also fairly new to web development. Here what im finding difficulty is to know how to access the required database! and i use postgresql and not mysql. :)

If you want to access remote database that is not in your control or your office, they remote owner must give some API access with manuals, so that you know what to pass and how to retrived infomation from that server.

Thanks Trivedi. That info must help :)

Member Avatar for diafol

The remote DB may be accessed if you have the remote hostname and if you the DB server allows permission. As a rule, you can get the details and set up permissions in cPanel or similar. Whether postgresql or mysql, shouldn't really matter.

Thanks diafol

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.