• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Data randomizer?

#1
Hi,

I need some idea for the randomizer. This will run on a cron job. What I want  to do is the script will pick 3 random rows from the database that marked as "not_started" then assign to one user. Then repeat that process until all users have assigned tickets.

This will happen from Monday to Friday. If the user only had 2 assigned tickets on Monday, the tool will attempt to assign 4 tickets for Tuesday (remember, 3 random rows per day, here since only 2 have assigned to the user, the remaining 1 will be summed for Tuesday) and so on..

If on Tuesday, the app only assigned 2 tickets, it will attempt to add 5 tickets for Wednesday.

Hope you understand my problem and hope someone can help me.

Thanks.
Reply

#2
Do you use MySQL?

In that case you could do that with your query.

SELECT * FROM `TABLE` WHERE `FIELD` = 'NOT_STARTED' ORDER BY RAND() LIMIT 3
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.