0

I have a system, survey form that I have developed. my problem is how do I Insert or assign the serial key value to the survey table in the database?

I have to two tables one to store the survey answers and the other table that stores the serial keys. After the user fills in the survey/questionnaire, how can I then assign a serial key to each completed survey(in the database), and then display to the user the assigned serial key.

Also How can I make sure that Once a specific serial key is assigned, it won't be assigned again.

I am using php and Jquery mobile and mysql to develope the system

I really need help.

1 Answers1

0

You want a UUID. There are functions to create these in several languages: http://php.net/manual/en/function.uniqid.php http://docs.oracle.com/javase/7/docs/api/java/util/UUID.html etc...

Matthew Gunn
  • 4,451
  • 1
  • 12
  • 30
  • Agree with Matthew, this is easiest way but if you want to create your own function for this you can check this post http://stackoverflow.com/questions/637278/what-is-the-best-way-to-generate-a-random-key-within-php – arussell Nov 11 '15 at 12:19