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

Recommended Answers

All 3 Replies

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?

No there is no problem. How will I go about it?

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.