Jump to content

Hey all, 

I tested this and i believe it works but i think it may be wrong.

Can anyone skilled in creating events help me correct the code. Thanks!

 

What i want to achieve:
It updates a field (flag) in a table (mytable) with a value of 0 after a certain time (6 hours and 10 minutes from when it was created) then removes itself from the scheduler. So i click a button, it creates the event and after 6 hours and 10 minutes the event sets flag = 0 and removes itself.

 

Code:

CREATE EVENT myevent ON SCHEDULE EVERY 6 HOUR STARTS CURRENT_TIMESTAMP + INTERVAL 6 HOUR + INTERVAL 10 MINUTE ENDS CURRENT_TIMESTAMP + INTERVAL 6 HOUR + INTERVAL 11 MINUTE DO UPDATE mytable SET flag = 0

 

------------------------------------

     ~ Live Love Code ~

------------------------------------

Link to comment
https://linustechtips.com/topic/429336-mysql-help-with-event/
Share on other sites

Link to post
Share on other sites

Why do you think it is wrong, if it works?

 

I am using it on a client server and he insists that it does not stay for 6 hrs and 10 min but i tested it on my local server and it works.

I just want someone to review it and see if the syntax is correct.

------------------------------------

     ~ Live Love Code ~

------------------------------------

Link to comment
https://linustechtips.com/topic/429336-mysql-help-with-event/#findComment-5758229
Share on other sites

Link to post
Share on other sites

I am using it on a client server and he insists that it does not stay for 6 hrs and 10 min but i tested it on my local server and it works.

I just want someone to review it and see if the syntax is correct.

 

Are you able to test it on their server?

Link to comment
https://linustechtips.com/topic/429336-mysql-help-with-event/#findComment-5758354
Share on other sites

Link to post
Share on other sites

Versions of MySQL running on your server and his?

 

Are the schemas the same?

How is this being added?

 

Php and database schema are the same.

I am using the codeigniter framework so when a form gets submitted the code is executed directly on the db.

So there is nothing wrong with the code?

------------------------------------

     ~ Live Love Code ~

------------------------------------

Link to comment
https://linustechtips.com/topic/429336-mysql-help-with-event/#findComment-5791553
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×