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

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -