Yeah already seen those links. So need some guidance.
Joel
Main Topics
Browse All TopicsDear Experts,
I need to create a trigger and subsequent function of some sort that will pass a value from a given query to a simple php script.
First, can a trigger be applied to a specific field in a row or must it be applied to the entire row within a table?
Assuming that the trigger is based on the row, I need the trigger to be triggered when data is inserted into the table creating a new record. Then the trigger needs to trigger a function (stored procedure) that will pass two values from the row, first being the recordID and then membershipnumber to a simple php scipt that will take these two values and provide another service that we create. The values can be passed into the script using the field names as the variable names.
The name of the table is called NewUserMessages and the field names are recordID and membershipnumber.
Thanks for the help in advance.
Joel
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
The triggers can be row triggers or statement triggers. I am not sure what would be the benefit of a field trigger. If you do a row trigger you can always check what the old and new value of a particular field is and perform actions based on that.
Basically you would create an after insert trigger that would then call whatever stored procedure you want with given arguments. Look at the dummy code below for some guidance.
Consider whether your Trigger function needs to return NEW else database will not update.
NEW column values can be compared to OLD values like this.
CREATE FUNCTION t1() RETURNS trigger AS $$
BEGIN
IF NEW."recordID" IS NULL THEN
RAISE EXCEPTION 'recordID cannot be null';
END IF;
IF NEW.membershipnumber <> OLD.membershipnumber THEN
SELECT f1(NEW."recordID", NEW.membershipnumber);
END IF;
RETURN NEW; -- need this or nothing happens
END;
$$ LANGUAGE plpgsql
Business Accounts
Answer for Membership
by: gheistPosted on 2009-08-14 at 06:57:18ID: 25098056
Ask if you need some more help than doc offers: docs/8.4/s tatic/sql- createtrig ger.html docs/8.4/s tatic/trig ger- exampl e.html
http://www.postgresql.org/
http://www.postgresql.org/