I am currently creating an Online RPG. My next module that I would like to add is a \"crimes\" section. Whereby you commit crimes in order to gain more money and experience. The majority of this I can handle, but I would like a timer interval between the times you can commit crimes. (So you commit a crime and then have to wait two minutes before you can commit another one). Is there anyway to write a countdown timer in a MySQL database which I can call and it will display the amount of time left until you can commit another crime.
Hopefully, this is possible. If not maybe a workaround which will have the same effect. NOTE: I would not like to use the Sleep() code.
I'm not totally sure, but I believe there is a date/time function that will return the difference between two times. I'm not at my workstation, so can't test/double check syntax but something along the lines of this should be a good start.
SELECT DATETIMEDIFF( (SELECT time FROM crimes WHERE ....), NOW());
Assuming you store each crime (and date) in the database. I'm probably wrong on the function name, but check the date and time functions in the docs for better info.