Jump to content
Sign in to follow this  
WaqasAhmed

update four records daily out of six records----mysql---php

Recommended Posts

I have a table containing 6 records i want to display first four records today and today date should be saved against those 4 records.On the next day remaining two records should be displayed and first two records as well and date should be saved and flag should b incremented as well.
i hope you guys are getting my point

12400793_987741697958623_12292473903678112510498_987741717958621_86615931551666712512695_987741694625290_57719615438023312592689_987741724625287_145219481775266

Share this post


Link to post
Share on other sites
UPDATE table
SET last_dty_timestamp = /* today's date */, duty_flag = duty_flag + 1
ORDER BY last_dty_timestamp ASC /* earliest records first */, person_id /* unique ID to guarantee a stable sort */
LIMIT 4 /* only update the first four records */

Share this post


Link to post
Share on other sites
UPDATE table
SET last_dty_timestamp = /* today's date */, duty_flag = duty_flag + 1
ORDER BY last_dty_timestamp ASC /* earliest records first */, person_id /* unique ID to guarantee a stable sort */
LIMIT 4 /* only update the first four records */

i have done the same......but how i can update next day........next day remaining two should b updated.....and first two as well..

Share this post


Link to post
Share on other sites

Are you saying that it does not work right now? Because that query says absolutely nothing about which day's records to update.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.