We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,289 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Check availability status

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 :)

5
Contributors
9
Replies
1 Day
Discussion Span
8 Months Ago
Last Updated
10
Views
abiec
Newbie Poster
6 posts since Jul 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

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.

urtrivedi
Posting Virtuoso
1,714 posts since Dec 2008
Reputation Points: 299
Solved Threads: 362
Skill Endorsements: 24

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!

ckarlss0n
Newbie Poster
4 posts since Aug 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

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.

diafol
Keep Smiling
Moderator
10,666 posts since Oct 2006
Reputation Points: 1,628
Solved Threads: 1,514
Skill Endorsements: 57

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

urtrivedi
Posting Virtuoso
1,714 posts since Dec 2008
Reputation Points: 299
Solved Threads: 362
Skill Endorsements: 24

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. :)

abiec
Newbie Poster
6 posts since Jul 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

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.

urtrivedi
Posting Virtuoso
1,714 posts since Dec 2008
Reputation Points: 299
Solved Threads: 362
Skill Endorsements: 24

Thanks Trivedi. That info must help :)

abiec
Newbie Poster
6 posts since Jul 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

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.

diafol
Keep Smiling
Moderator
10,666 posts since Oct 2006
Reputation Points: 1,628
Solved Threads: 1,514
Skill Endorsements: 57

Thanks diafol

abiec
Newbie Poster
6 posts since Jul 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0855 seconds using 2.7MB