MySQL event not working.
#1

PHP код:
CREATE DEFINER=`root`@`localhostEVENT `autounbanON SCHEDULE EVERY 1 SECOND STARTS '2015-07-01 23:11:48' ENDS '2015-07-11 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO UPDATE `bansSET `banned`=0 WHERE `banned`=AND (UNIX_TIMESTAMP() >= `banexpire`) 
This is not working


Image to database.


I changed banexpire time to really small value as current UNIX_TIMESTAMP() would be lot greater than this.
But still no use i even did the event for per minute but no use.
Reply
#2

First, make sure the MySQL event scheduler is enabled. It is not enabled by default. To check if it's enabled, run the MySQL query 'show processlist;'(SQL tab of phpMyAdmin will suffice) and see if there's a task under the user 'event_scheduler'. If there isn't, it's not running. Keep in mind, to be able to view processes for all users(IE event scheduler), you'll need to login as root or have the 'process' privledge. So in short, to check, you'll need root access to the server.
If it's indeed not enabled, you'll need to enable it(requires root access): https://dev.mysql.com/doc/refman/5.1...iguration.html

I'm going to make an assumption that you're using BlueG's MySQL plugin, and you're using a halfway up to date version of it. If not, you still should get the basic idea.

This should do you over just fine, I'd explain, but honestly, it speaks for itself, so if you have questions, you know what to do.

Obviously under the OnGameModeInit callback:
Код:
mysql_query(ConnectionHandle, "CREATE EVENT `autounban` ON SCHEDULE EVERY 1 SECOND  DO UPDATE `bans` SET `banned`='0' WHERE `banned`='1' AND UNIX_TIMESTAMP() >= `banexpire`;", false);
Do keep in mind that events do not magically go away after your server is stopped! If you don't stop them, they'll run for an infinite amount of time, which is typically undesireable.
Код:
mysql_query(MainPipeline, "DROP EVENT `tbans`", false);
EDIT: Just noticed your screenshot, and it looks like you already enabled the event scheduler.
Reply
#3

This is just on my localhost, I'm using BlueG's plugin (Latest VERSION).
This is not the problem about plugin or my game mode script.
As you can see i already tuned on the events for that database it should have worked; but no it's not working. About the timer I won't really be using it for 1sec i might do it for 1 Hour just did 1sec for testing purpose.
Reply
#4

Quote:
Originally Posted by AroseKhanNiazi
Посмотреть сообщение
This is just on my localhost, I'm using BlueG's plugin (Latest VERSION).
This is not the problem about plugin or my game mode script.
As you can see i already tuned on the events for that database it should have worked; but no it's not working. About the timer I won't really be using it for 1sec i might do it for 1 Hour just did 1sec for testing purpose.
Yes, I noted that in a post edit. I tested it out, and the query I provided in the format I provided works. Upon further review, your query does look fine, however, I tested it myself with the exact code provided and it works fine for me, so I don't know what to tell you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)