I got an database (phpmyadmin) in which I put users, grid looks like this
id ------ user ------- categorie_bit ------ calender_week
1 ------- Kevin ------ 01------------------- 39
the id and user is self explained. Categorie_bit stands for the current job he / she has to do like having a walk with the dog.
0 - no job
1 - job 1
10 - job 2
11 - both jobs
and the calender week shows the current calender week.
like this in php:
$date = new DateTime();
echo $date->format('W');
I got various users, each user has to do a job for this calenderweek for this instance 39. The user is picked randomly from the database. (I used a PDO Wrapper)
$table = "users";
$columns = array("id", "firstname");
$orderBy = array('RAND()');
$result_set = $db->select($table,$columns, Null, Null, $orderBy, 1);
In the next step I give the user a "job".
Categorie_bit = 1.
The problem is now that I want to pick a user who did not have a "job" last calender week, so that all users are treated equally.
My first idea is to change the random picker somehow.
Anyone knows how to accomplish this?
Aucun commentaire:
Enregistrer un commentaire