0

Very simple question, looking on google brings up plenty of MySQL resources on triggers but I can't find the answer I am looking for.

What I want to know is; When I perform a query on a database from PHP, Does MySQL provide any way for PHP to know a trigger was called?

I am trying to implement an achievement system in PHP, and MySQL triggers seem to be the best way to track changes to data.

3
Contributors
4
Replies
8
Views
5 Years
Discussion Span
Last Post by mschroeder
0

No, it does not. MySql triggers work on the MySql server only, and do not provide feedback to other applications. Basically, I think it could be possible to write your own user defined function for MySql, but that would be written in C, not in PHP. In PHP you would have to settle for a polling mechanism.

0

Thought as much, I knew MySQL wouldn't make a call to a PHP script, but I wondered if there was a PHP function like the one that gets the ID of the last inserted row that would tell me if a trigger was run.

Ah well, thanks anyway.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.