logicslab Posted March 22, 2011 Share Posted March 22, 2011 Hi Pals, I am a PHP programmer like to know How I can implement mysql Database Trigger in my code. Do you can give a "Hello world" sample for same trigger idea. I am waiting your reply ASAP. Thankfully Anes P.A Quote Link to comment https://forums.phpfreaks.com/topic/231357-need-idea-about-database-trigger-in-php-mysql/ Share on other sites More sharing options...
The Little Guy Posted March 22, 2011 Share Posted March 22, 2011 http://dev.mysql.com/doc/refman/5.0/en/create-trigger.html Quote Link to comment https://forums.phpfreaks.com/topic/231357-need-idea-about-database-trigger-in-php-mysql/#findComment-1190730 Share on other sites More sharing options...
logicslab Posted March 22, 2011 Author Share Posted March 22, 2011 Hi the Little Guy, I mean a practical sample which work in Both PHP and MySql like we study Hello world sample in php .... I need an implementation code not any Stuff about Trigger details. Thankfully Anes Quote Link to comment https://forums.phpfreaks.com/topic/231357-need-idea-about-database-trigger-in-php-mysql/#findComment-1190739 Share on other sites More sharing options...
The Little Guy Posted March 22, 2011 Share Posted March 22, 2011 That page does have implementation code, for example: delimiter | CREATE TRIGGER testref BEFORE INSERT ON test1 FOR EACH ROW BEGIN INSERT INTO test2 SET a2 = NEW.a1; DELETE FROM test3 WHERE a3 = NEW.a1; UPDATE test4 SET b4 = b4 + 1 WHERE a4 = NEW.a1; END; | Quote Link to comment https://forums.phpfreaks.com/topic/231357-need-idea-about-database-trigger-in-php-mysql/#findComment-1190866 Share on other sites More sharing options...
logicslab Posted March 23, 2011 Author Share Posted March 23, 2011 hi The Little Guy, Do I can Write this code directly in a PHP file to implement some trigger functionality. I really need it's usage in context of a real PHP Program. So I ask I need a "sample" Hello world Code . If any one know it , pls Help me thankfully Anes P.A :'( Quote Link to comment https://forums.phpfreaks.com/topic/231357-need-idea-about-database-trigger-in-php-mysql/#findComment-1191160 Share on other sites More sharing options...
trq Posted March 23, 2011 Share Posted March 23, 2011 What The Little Guy has shown you is an SQL statement, SQL statements are executed via (amongst others) PHP's mysql_query() function. See the manual (here) for details of it's usage. Quote Link to comment https://forums.phpfreaks.com/topic/231357-need-idea-about-database-trigger-in-php-mysql/#findComment-1191175 Share on other sites More sharing options...
logicslab Posted March 23, 2011 Author Share Posted March 23, 2011 Thanks Thorpe , I got the idea ... I am waiting for this answer YET ... my Special thanks to The Little Guy Too... Thankfully Anes P.A Quote Link to comment https://forums.phpfreaks.com/topic/231357-need-idea-about-database-trigger-in-php-mysql/#findComment-1191178 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.