Click here to Skip to main content
15,879,096 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

can anyone suggest me how to generate unique random number in PHP. i am using mt_rand() function and its working perfectly, but i want to compare that unique number with my table's field. i don't know how to do this.

Please help me in solving my problem.

Thanks in advance!!
Maciej Los 30-Dec-13 3:39am    
What have you done till now? Where are you stuck?
ritika luthra 30-Dec-13 5:14am    
i am not able to compare that random number with database.
Maciej Los 30-Dec-13 5:31am    
I know that, but: what have you done to compare these random numbers with database?
AndyInUK 30-Dec-13 7:13am    
So your question is not how to generate random number but it's how to compare random number with database. So all you have to do is assign that random number to a variable and connect to database and run a query to compare the two. Best is if you show us what have you done so far and where exactly are you stuck.
ritika luthra 31-Dec-13 2:43am    
i am not getting any logic to compare that random number with database.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900