[nycphp-talk] A tale of two tables...
Aaron Fischer
agfische at email.smith.edu
Fri Mar 11 15:28:37 EST 2005
Greetings,
I'm about to build a little mini application and would appreciate a
little feedback/advice.
The application allows for a user to log in and view a list of hosts
and guests. The data is stored in two MySQL tables (one for hosts and
one for guests).
The user will be able to pick a host and match them to a guest.
My plan is to have a column called match_id in both the host and guest
table. When someone selects a host and guest, the app will insert a
unique id into both the host and guest record. My plan was to use a
date/time stamp (including seconds) to create the unique match_id.
Another page view will display the list of matched hosts and guests,
where I will query both tables and join them by the match_id.
So, here are my questions:
Is there a better way to create a unique id than the time/date stamp?
What would happen if two users are logged in at the same time and make
a match at the exact same time? Not sure how MySQL handles when
requests are being made at the same time. Would it barf? Could it
potentially create two identical date/time stamps for two different
matched groups? (That would be very bad, given how I have designed the
system so far).
Thanks in advance for any info and/or pointers, or even just validation
that I'm on the right track. =)
-Aaron
More information about the talk
mailing list