On Jun 30, 2011, at 9:57 PM, Guru™ wrote:
I have a question about php-mysql. Is it possible that I can have 2
different fields in a mysql table, and when a user fill out the form
for the
first time the input goes to first field and when the second user
fill out
the form the input goes to 2nd field. For example: Lets say I have 2
fields
called $name1 and $name2. Now when 1st user input the data it goes
to $name1
and then when the second user input the data it should check if the
$name2
is NULL and if yes then the data goes to $name2 otherwise it should
again
start with $name1.
I'm sure it is quite possible. I am assuming these are independent
transactions, i.e, they don't happen simultaneously? (If there is a
chance they may happen simultaneously, you'll need to implement record
locking.)
You'll want to do this with MySQL's GET_LOCK and RELEASE_LOCK so you
can do both a lookup to see if $name1 is set and if it's not set it
before another process comes along which may try to do the same thing.
Also, not sure what happens when person 3 comes along?
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php