I need to build a function that selects a random row of a field, but not any row.
Lets say the fields are called
id, user, one, two, three, four,five,six
1,'jack',0,0,0,1,0,0
When the function is called I need to update one of the following fields: one, two, three, four,five,six that has a value of ‘0’ and set it to ‘1’. Therefore one field cannot be selected more than once. In reality there are over 10 fields that need this kind of handling. The order has to be random.
I’m still trying to figure out the logic without writing too many lines. Any suggestions?
how about:
//version 2