- <?php
- $dbAdapter = new mysqli('host', 'user', 'pass', 'db');
- $sql = "
- DROP TRIGGER IF EXISTS `table_insert_trigger`;
- CREATE TRIGGER `table_insert_trigger` BEFORE INSERT ON `table`
- FOR EACH ROW
- SET NEW.`CreateDate`=NOW();
- ";
- $dbAdapter->multi_query($sql);
就是這麼簡單,為什麼都沒有人寫文章,害我找好久!囧
參考文章:
How To Use Triggers to Track Changes in MySQL
MySQL / PHPMyAdmin Trigger Syntax
2 回應:
您好, 謝謝您的文章.
hello... hapi blogging... have a nice day! just visiting here....
張貼留言