User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the MySQL section within the Web Development category of DaniWeb, a massive community of 402,095 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,451 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MySQL advertiser: Programming Forums
Views: 262 | Replies: 3
Reply
Join Date: Oct 2006
Posts: 62
Reputation: welbyobeng is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
welbyobeng welbyobeng is offline Offline
Junior Poster in Training

Mysql

  #1  
Mar 13th, 2008
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
Last edited by peter_budo : Mar 13th, 2008 at 7:52 pm. Reason: Keep It Organized - please use [code] tags for easy readability
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Dec 2007
Posts: 112
Reputation: mwasif is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 13
mwasif mwasif is offline Offline
Junior Poster

Re: Mysql

  #2  
Mar 14th, 2008
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?
Reply With Quote  
Join Date: Oct 2006
Posts: 62
Reputation: welbyobeng is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
welbyobeng welbyobeng is offline Offline
Junior Poster in Training

Re: Mysql

  #3  
Mar 14th, 2008
No there is no problem. How will I go about it?
Reply With Quote  
Join Date: Dec 2007
Posts: 112
Reputation: mwasif is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 13
mwasif mwasif is offline Offline
Junior Poster

Re: Mysql

  #4  
Mar 14th, 2008
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.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb MySQL Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the MySQL Forum

All times are GMT -4. The time now is 1:46 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC