Jump to content

reseting counter


vmicchia

Recommended Posts

I'm not sure if this is the right form I may need to put this in the mySQL forum so apologies if it's in the wrong place. I would however like to do this in php.

 

What I need to do is set up a counter that resets every day at midnight. So it would start with 01 and count up till 12:00AM server time and then reset to 01 for the next day. This is for an ordering system to add a number to the end of any order.

 

Any help is much appreciated. I know it's not much info but I'm not even sure where to begin such a thing.

Link to comment
Share on other sites

use microtime() - it's a built-in function of PHP that gives you the number of seconds + milleseconds since the UNIX Epoch (1st January 1970) according to the server time. you can use time() for just the seconds but in case someone orders something on the same second you will want microtime to differentiate between the two orders.

 

Although usually you would implement your own unique numbering system.

 

hope this helps

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.

×
×
  • 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.