Re: Back from the dead with a racing question!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Friday 17 July 2009 16:27:10 Bastien Koert wrote:
> On Fri, Jul 17, 2009 at 11:12 AM, Jason Pruim<jason@xxxxxxxxxxxxxx> wrote:
> > Hi everyone!
> >
> > So some of you may have noticed that I have been away for quite awhile...
> > Been trying to get settled (Moved across the country) and getting a job.
> >
> > And now that that is done I have a question about a project that I might
> > be doing for my current employer and want to do it properly.
> >
> > If all goes through, I'll be writing an online database that upwards of
> > 10 people will be using at various times through out the day. Basically,
> > in a form they fill out a model number, customer name, phone number etc.
> > etc.. And then submit the form. After submitting they need to write the
> > log number on some paperwork. If I have 2 people submit the form at the
> > same time, I'm thinking I could end up with a race condition and they
> > might get the wrong log number (The log number is simply a consecutive
> > record number)
> >
> > Do I need to be reading up on locking tables/rows? Or in my situation as
> > I've briefly described it do I not have to worry about it? Or is there a
> > third door with the magic bullet that will solve all my problems? :)
> >
> > Any advice is greatly appreciated as always, RTFMing is good as well, as
> > long as M is defined :)
> >
> > I'm not afraid of google either, just need the right terms to hit it with
> > so I don't go into "search overload" as the commercials for a rival
> > search engine claim :)
> >
> > Thanks Everyone!
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
>
> Hey Prune,
>
> nice to see ya again.
>
> Is the log number formatted? If not, just use an autonumber in the
> database. Most allow you to pick the starting point so setting the
> value shouldn't be a problem.
>
>
> --
>
> Bastien
>
> Cat, the other other white meat

Just have a field that is an auto_increment in the table, and the database can 
sort out making sure it is unique. You can use this as part of your log 
number if you wish to ensure that the log number is also unique, or just use 
the auto_id value straight up.

-- 
Thanks,
Ash
http://www.ashleysheridan.co.uk

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux