1

How can i run a script as soon as mysql database is updated. I have a script in test.php, and i want to run every time, i get sms into (or entry u can say) my database example if massage is received at 10:20:56 sec script should run at 10:20:57 sec.. any thing will do like cronjob java php .any script

Harinder
  • 1,257
  • 8
  • 27
  • 54

3 Answers3

1

You could try to create ON UPDATE trigger and try to invoke PHP script. Here is more about that.

Community
  • 1
  • 1
Alex Stybaev
  • 4,623
  • 3
  • 30
  • 44
0

Take a look at triggers in conjunction with your mysql database. With that you can run a sql-query on every update, insert or modification.

Simplified Syntax:

CREATE
    TRIGGER trigger_name trigger_time trigger_event
    ON tbl_name FOR EACH ROW trigger_body
stUrb
  • 6,612
  • 8
  • 43
  • 71
0

If value is inserted via your code you can just add call of script just after insert. If it is inserted in code, that is not managed by you, than you should poll your database every N seconds and check for new records and call your php script.

dbf
  • 6,399
  • 2
  • 38
  • 65