hi2,

Could anyone please show me how to update a dataValue each time a data in another database changes its value ?


Here is a screenshot of my 2 databases I would like that;

Each time a value in database1-table1 is changing,
It sends a trigger to change the age value in database2-useragetable

enter image description here



I attempt to create a trigger from this link. Using Trigger to update table in another database
And Here is the code and the screenshot of it.

    AFTER UPDATE ON table1.value  FOR EACH ROW
      BEGIN
    UPDATE TABLE database2.useragetable
    SET  age = NEW.value

    WHERE no = NEW.no
    END;

enter image description here

1 Answers

1
Nishita On

Please refer to the following wiki to create a trigger:

https://github.com/phpmyadmin/phpmyadmin/wiki/Trigger

  1. In phpMyAdmin, select the database (database1-table1) that you want to work with.

  2. Go to the SQL tab at the top of the page.

  3. In the "Run SQL query/queries on database" form, change the Delimiter to $$. (Located in a small box at the bottom of the form)
  4. Enter your SQL trigger into the main dialog box on the form.