Scheduled an SQL Event with your MySQL Server

Results 1 to 1 of 1
  1. #1
    Full-Stack Web Developer Emetophobic is offline
    True MemberRank
    Jan 2012 Join Date
    Nice, FranceLocation

    Scheduled an SQL Event with your MySQL Server

    Hello guys,
    I want to post today a tutorial that will easily change your life about your retro management using Phoenix, Butterfly or any Uber based emulators. UberCMS is the only CMS that fit 100% all emulators based on it, I talk about a minor detail, people may forget it sometimes but here we comes, I want to talk about scheduled SQL events. For this tutorial I will explain how to use this tool for reloading automaticaly each 24 hours Respect Points et Scratch Points, but you can use it for others task as reload credits for a subscription every 31 days where the users have that column to 1 etc & etc..

    /!\ You have to be the owner of your SQL server, this tutorial doesn't work for shared/mutual hosting /!\

    I will make this tutorial for 2 version of phpMyAdmin: 3.5.2 and minor versions. Why 3.5.2, you say? You will see that 3.5.2 version of phpMyAdmin is a little bit less complicated than others.. (I can be confused about the versions, I don't know if the event scheduler was easily configurable too before 3.5.2)

    phpMyAdmin 3.5.2 tutorial:
    1st Step: Log In into your phpMyAdmin and select your database on the list as normal.

    2nd Step: On the toolbar click on more (or whatever it's called in english and others languages, I'm french), and click on Events

    3rd Step: Set the scheduler to actived or on (I don't know well the english version of PMA)

    4th Step: Click on add an event and fill the fields with the required informations, put a name for your event. and change the event type to RECURRING. In the screenshot here's the informations to fill to create the event to reload respect points:

    And for Scratch Points:

    /!\ Obviously change the YOURDATABASEUSER to your username for the database and MACHINEHOST the host shown in top navigation bar /!\

    Now take on the older versions of phpMyAdmin that don't have this tool:

    1st Step: Log In to your phpMyAdmin and stay on the host dashboard and click on SQL in the toolbar.

    2nd Step: And Paste this code inside, this will set the event scheduler variable to ON (Change ON to OFF and 1 to 0 in the SQL query to take off the variable)

    SET GLOBAL event_scheduler = ON;
    SET @@global.event_scheduler = ON;
    SET GLOBAL event_scheduler = 1;
    SET @@global.event_scheduler = 1;
    3rd Step: Now go on your hotel database and click on SQL in the toolbar, and paste this code inside.

    CREATE EVENT e_daily
          EVERY 1 DAY
        COMMENT 'Reload Respect Points.'
          UPDATE user_stats SET DailyRespectPoints = "3";
    For Reloading Scratch points here's the code too:

    CREATE EVENT e_daily
          ON SCHEDULE
          EVERY 1 DAY
        COMMENT 'Reload Respect Points.'
          UPDATE user_stats SET DailyPetRespectPoints = "3";

    And that's all, you can obviously change the query by what you want to create the wished event
    I've put all the image in a RAR file attached to this thread in case of the link of screenshots die one day, all image file are named to follow his step.


    Don't doubt to like this tutorial and tell me if it works perfectly as I've seen it working on my hotel,
    Emetophobic (Originaly posted under Exception on Otaku)