![]() |
|
|
Thread Tools |
|
#1
|
||||
|
||||
|
Random Number, if duplicate?
I want to use this random code generator, to store in the database a code. I want this number to be unique. How can I keep PHP from duplicating a code saved in the database? I can tell MySQL to keep it unique, but I don't want an error page. I want to keep errors to a minimum. Thank you for the help. I was thinking of a loop to check if it exists until it finds a unique number and end the loop before it spits out the page with the code in a hidden field. I just don't know what codes to use. >_< No members have liked this post.
|
||||
|
#2
|
|||
|
|||
|
What are you trying to do with this?
__________________
Marco van Herwaarden Ex vBulletin.org Coordinator No members have liked this post.
|
|
#3
|
||||
|
||||
|
Well, I want this for a gallery. When someone makes an album, the random number generator would create a number. The user would have to keep this to go back to view the album. Kind of like a passcode... key kinda thing.
No members have liked this post.
|
|
#4
|
||||
|
||||
|
Why not just use mysql's auto_increment attribute, which adds a unique identifer to table rows?
No members have liked this post.
|
|
#5
|
||||
|
||||
|
Well, I don't want single digit keys. Otherwise, random people will just type 1, 2, 3, 4, 5...and have access where they're not suppose to be.
No members have liked this post.
|
|
#6
|
|||
|
|||
|
So you want to make it that anybody that want to view an album needs a password? Or just the original owner of the album when they want to edit it?
__________________
Marco van Herwaarden Ex vBulletin.org Coordinator No members have liked this post.
|
|
#7
|
||||
|
||||
|
If the users types in the correct passcode, they can view the album.
No members have liked this post.
|
|
#8
|
|||
|
|||
|
And how will they get that password?
Wouldn't it be easiest if you let the user who creates the album just let choose a password?
__________________
Marco van Herwaarden Ex vBulletin.org Coordinator No members have liked this post.
|
|
#9
|
||||
|
||||
|
It would be emailed to them.
lol I have it figured out. I just want to know how to keep it from duplicating; if it ever happend. No members have liked this post.
|
|
#10
|
||||
|
||||
|
Why does it matter if you happen to get a duplicate ?
__________________
Cable Forum - DigiGuide Please Note: I will not answer support questions via e-mail or PM - please use the relevant thread or forum. Senior vBulletin Developer : Please do not PM me about custom work - I work for Internet brands and no longer have the time to undertake any. No members have liked this post.
|
|
#11
|
||||
|
||||
|
I wouldn't want to run into a problem if two albums have the same key.
No members have liked this post.
|
|
#12
|
||||
|
||||
|
What problem exactly ?
__________________
Cable Forum - DigiGuide Please Note: I will not answer support questions via e-mail or PM - please use the relevant thread or forum. Senior vBulletin Developer : Please do not PM me about custom work - I work for Internet brands and no longer have the time to undertake any. No members have liked this post.
|
|
#13
|
||||
|
||||
|
What I want is to filter the albums by a key. I just want one album per key. If two albums is to have the same key, both albums would be displayed. I do not want that. I want them to be displayed individually.
No members have liked this post.
|
|
#14
|
||||
|
||||
|
Prefix it with the userid then.
__________________
Cable Forum - DigiGuide Please Note: I will not answer support questions via e-mail or PM - please use the relevant thread or forum. Senior vBulletin Developer : Please do not PM me about custom work - I work for Internet brands and no longer have the time to undertake any. No members have liked this post.
|
![]() |
«
Previous Thread
|
Next Thread
»
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Random Number BBCode | spongebobrox128 | vBulletin 3.5 Add-ons | 13 | 02 Apr 2006 20:58 |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
| Thread Tools | |
|
|
| New To Site? | Need Help? |
All times are GMT. The time now is 10:42.



