Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help with a trigger?

Status
Not open for further replies.

lagg

Technical User
Oct 14, 2002
111
IE
I need to create a trigger for MySQL database table. I want to put a message in one table following the update of another table. The trigger should only operate on each new entry as it arrives. I have found out how to do this on an SQL Server how can I do it in MySQL. The following code is the SQL server:
CREATE TRIGGER autoreply ON table1 FOR INSERT
AS
DECLARE @tel VARCHAR(30)
SELECT TOP 1 @tel=field1 FROM table1 ORDER BY ID DESC
INSERT INTO table2 (field2,field3,field4) VALUES
(@tel,'Thank you for the message','send')
GO

It would be great if you could help


 
Have either of you got any suggestions as to how i can achieve this other than triggers?
 
Im not sure what you mean by that. Is it when using PHP? Im not very familiar with using MySQL actually. I was hoping i could just get the database to perform the operation on its own
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top