php - Selecting random rows from a table automatically -
php - Selecting random rows from a table automatically -
i'm working on project requires back-end service. using mysql , php scripts accomplish communication server side. add together new feature on back-end , ability generate automatically table 3 'lucky' members table_members every day. in other words, mysql pick 3 random rows table , add together these rows table (if possible). understand that, can accomplish if manually phone call rand() function on table ... painful!
there way accomplish above?
update:
here solution on after comments/suggestions other users
create event `draw` on schedule every 1 day starts '2013-02-13 10:00:00' on completion not preserve enable insert tbl_lucky(`field_1`) select u_name tbl_members order rand() limit 3
i hope helpful , others.
you can utilize insert ... select
, select 3 rows order rand()
limit 3
for more info insert ... select statement - see
it's possible automate every day job mysql events(available since 5.1.6)
php mysql random
Comments
Post a Comment