Need help please.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
tapas_bahirbag
Forum Newbie
Posts: 14
Joined: Sun Aug 06, 2006 6:54 am
Contact:

Need help please.

Post by tapas_bahirbag »

how can i generate random alphanumeric code of length 5 and must be unique every time?

please help me.

Thanks,
Tapos Pal
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Post by Benjamin »

You can generate a random alpha numeric string and store it in a database once it has been used.
tapas_bahirbag
Forum Newbie
Posts: 14
Joined: Sun Aug 06, 2006 6:54 am
Contact:

Post by tapas_bahirbag »

but, i dont want to check database for uniqueness.
miro_igov
Forum Contributor
Posts: 485
Joined: Fri Mar 31, 2006 5:06 am
Location: Bulgaria

Post by miro_igov »

Then save all used codes in a file and read it each time before to issue new code :) No other way for uniqueness.
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Post by califdon »

And please use a descriptive Subject for any future posts. Subjects like "Help!" are usually ignored by most of us.
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

tapas_bahirbag wrote:but, i dont want to check database for uniqueness.
So what? If you want it to be unique as according the database, you have to use the database for it.
tapas_bahirbag
Forum Newbie
Posts: 14
Joined: Sun Aug 06, 2006 6:54 am
Contact:

Post by tapas_bahirbag »

thanks for reply. my code is now running. i use database for uniqueness.


Regards,
Tapos Pal
Post Reply