I'm developing a web application with zend framework. It is an app for selling movie tickets. The app allows users to select a seat and then buy the ticket. (The problem is similar to the classical air ticket booking.) I have two problems.
Problem 1: The page that shows all seats has to refresh with ajax (a seat is green if available and red if unavailable): each seat is a div in the page. For example if USER A is watching the page with the seats and another USER B buy a ticket, the corresponding seat has to become red for USER A without refresh the page. How could i refresh every div? i'd like to use jquery, i tried to do a json request for each div every second but it is too slow. Any idea?
Problem 2: How could i manage the concurrency? If USER A and USER B click simultaneously to buy the same ticket (a ticket for the same seat) what do i have to do? I'm using a InnoDB engine, but do i have to manage the transaction in the relative controller?
Thanks a lot!