About PHP ID similar to stagger a certain number of writes about the problem
Source: Internet
Author: User
Questions about how to stagger a certain number of writes with similar PHP IDs
A seating chart, a student table
Seating chart:
ID Zid UserID
Student table:
UserID Cityid
Now I want to randomly write the student table students to the seating chart, seating chart Zid is a 2 digit seat number
For example, the student table has 20 students, of which 5 cities Cityid the same, 5 Cityid the same student to stagger 5 digits in the seating table Zid so, how can it be achieved?
A PHP for testing purposes to prevent the city Cityid the same student seat.
Thank you, first!
------to solve the idea----------------------
Stagger 5 bits is the interval between 5 and above, or the interval 4 can be?
If it is the former, then 5 students of the same Cityid will not be able to appear in the classroom of 20 people at the same time
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service