0

Hello,
I'm just looking for an answer or idea.
I plan to connect vb.net to mysql (which is done) and also the PHP connected to the mysql.
But I'm confuse with something.

VB.NET is use for offline things (which people will come to store and buy), but PHP is buying / booking online. (You know the airport things right ? customer can directly go to the airport and buy tickets or they can buy tickets from the internet)

For ex :
Customer A come to airport and buy a ticket which is only left 1 tickets. Customer B wanted to buy from the internet. Both of them saw there is only left 1 tickets. So, both of them buying. When Customer A buy, the employee click buy at the same time with Customer B.
In here, I'm confuse, how to declare which person should get the ticket because they click buy at the same time (server time because PHP and MySQL located to the server and vb.net applciation located to other PC/Machine) ?.

So when generating ticket ID, either employee for Cust A or Cust B know that the ticket just bought buy other person.

Sorry If it is a bit confusing, hope you understand.

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by samuel_1991
0

Hello,
I'm just looking for an answer or idea.
I plan to connect vb.net to mysql (which is done) and also the PHP connected to the mysql.
But I'm confuse with something.

VB.NET is use for offline things (which people will come to store and buy), but PHP is buying / booking online. (You know the airport things right ? customer can directly go to the airport and buy tickets or they can buy tickets from the internet)

For ex :
Customer A come to airport and buy a ticket which is only left 1 tickets. Customer B wanted to buy from the internet. Both of them saw there is only left 1 tickets. So, both of them buying. When Customer A buy, the employee click buy at the same time with Customer B.
In here, I'm confuse, how to declare which person should get the ticket because they click buy at the same time (server time because PHP and MySQL located to the server and vb.net applciation located to other PC/Machine) ?.

So when generating ticket ID, either employee for Cust A or Cust B know that the ticket just bought buy other person.

Sorry If it is a bit confusing, hope you understand.

So what happens is that VB.NET part, it is a in-store employee's work to get the transaction done while Php one is a web application on www.your-site.com for customer to buy online straight right?

I am glad to say that:
1: VB.NET is still online stuff, as it requires the staff's terminal to go online.
2: The database connection will limit each transaction at a time, meaning which, despite both person clicked on the same time, it is up to database to handle which transaction to be processed first in a split second.
3: You should do a validation part on the database part, and returns an error if the ticket has reached 0. (Something like

'I presume you have the Database connection / Command thing ready
'Step 1: Get the number of tickets left.
dbCommand.CommandText = ""'Code is omitted for simplicity
dbConn.Open() 'Opens a database connection
Dim Qty As Integer = CInt(dbCommand.ExecuteScalar())
If Qty < 0 Then
Return False
Else
'Insert the record of a Customer / Buyer into database
dbCommand.CommandText = "" 'Code is omitted for simplicity
dbCommand.ExecuteNonQuery()
'Another update of the amount of tickets it has right now.
dbCommand.CommandText = "" 'Code is omitted for simplicity
dbCommand.ExecuteNonQuery()
dbConn.Close() 'Close database connection
End IF

Edited by samuel_1991: To enhance the command text

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.