php-windows Digest 19 Aug 2001 06:39:13 -0000 Issue 709 Topics (messages 8936 through 8936): Re: A uniqe ID for every item 8936 by: Mad Nas Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] ----------------------------------------------------------------------
"B.A.T. Svensson" <[EMAIL PROTECTED]> wrote in message 27E647E5629ED211BF78009027289C630337E3CF@mail1">news:27E647E5629ED211BF78009027289C630337E3CF@mail1... > >Hi all > >How can generate a uniqe id for every object of a class, > >for example > > > > A very simple (untested) example could be: > > int UniqueNumer(void) > { > static int nUniqueKey = 0; > return ++nUniqueKey; > } > > > >class A > >{ > > var $id; > > function A() > > { > > $this->id = UniqueNumer(); > > } > >} > > > It could be help full to know why you need to > create a unique number? Is it for ex only for naming > temporary files? Or should the uniqueness persist > over time? Hi I design a HTML form and any entry have three part : 1 ) Display Label, It's a label for field. 2 ) Field Entry, It's a form object <INPUT> , <SELECT> <TEXTAREA> ) 3 ) Error Msg, It's a anchor ( <A name="fieldname">). I design a class for entry object . Now i must check validation input data and if has error show a message in Error Msg. For this work i must have a unique name for any entry. With thanks for answer mad Nas