0

How can I create a trigger to UPDATE this for me when a new record is inserted.

I want to create a column called "fullthumb" where by default it has the words "http://example.com/thumbs/" and add the words in "thumb" column.

In syntax:

UPDATE files SET
fullthumb = CONCAT('http://example.com/thumbs/', thumb);

I know the general syntax of CREATE TRIGGER is :

CREATE TRIGGER trigger_name trigger_time trigger_event ON tbl_name FOR EACH ROW trigger_statement

but I am new at mysql...Can someone help me create trigger with the above syntax

2
Contributors
3
Replies
4
Views
9 Years
Discussion Span
Last Post by mwasif
0

Hi welbyobeng,

I have just realised that this is not possible with TRIGGER. There is a limitationthat you can not use the same table to read/write who invoked the trigger.

So you have to implement this when you are inserting the new record. Is there any problem to save the fullpath at the time of insertion?

0

Can you please tell me what you are trying to achive?

If you want to save the full path to the thumb, then I suggest you the save the image name and path (without image name) separately.

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.