Search the Community
Showing results for tags 'activerecord'.
-
I am implementing a form using CActiveForm (Yii) and my database is in MySQL. My requirement is to implement a solution which would enroll and assign my users (candidates, filling the form) with date_of_test and and unique roll_number based on test_locations. I have multiple test_locations and they have specific seating capacity for a day e.g Arizona = 1000, Florida = 200. Now based on the seating capacity i need to assign roll_number (unique) and date_of_test to a candidate, e.g in a candidate table data would something be like: id | roll_number | date_of_test | state | <--- ID is auto incremented by MySQL ----------------------------------------------- 1 | 999 | 11/20/2013 | Arizona ----------------------------------------------- 2 | 50 | 11/20/2013 | Florida ----------------------------------------------- 3 | 1000 | 11/20/2013 | Arizona ----------------------------------------------- 4 | 1001 | 11/21/2013 | Arizona <--- Next Date given to candidate ----------------------------------------------- Test locations are assigned to candidates by application based on their present location i.e if someone is from Arizona state his test location would automatically be selected as Arizona (implemented via simple dependent dropdown). I am finding really hard to implement this logic of assigning roll_number and date_of_test to candidates, as i don't want anyone to have same roll number and anyone given a date_of_test more than the seating capacity of a location. Maybe Yii/PHP/MySQL has some function which i am not aware would assist me in implementing it easily. Thus, requiring assistance.