943,926 Members | Top Members by Rank

Ad:
  • MySQL Discussion Thread
  • Unsolved
  • Views: 1140
  • MySQL RSS
Mar 10th, 2008
0

IS it possible

Expand Post »
Is it possible to make a column on my database that automatically copy another column on the same table string together with another url?

for example on my database "ewelby_k5" I want to create a new column called (fullthumb) on table "files" where "fullthumb" stores "http://k5live.com/thumbs/ + column "thumb" "

so that I will get http://k5live.com/thumbs/image.jpg on "fullthumb" column
Reputation Points: 13
Solved Threads: 0
Junior Poster in Training
welbyobeng is offline Offline
75 posts
since Oct 2006
Mar 10th, 2008
0

Re: IS it possible

Create a column in the table with ALTER TABLE command. Then execute the following query
MySQL Syntax (Toggle Plain Text)
  1. UPDATE files SET
  2. fullthumb = CONCAT('http://k5live.com/thumbs/', thumb);
Reputation Points: 29
Solved Threads: 47
Posting Whiz
mwasif is offline Offline
312 posts
since Dec 2007
Mar 10th, 2008
0

Re: IS it possible

Click to Expand / Collapse  Quote originally posted by mwasif ...
Create a column in the table with ALTER TABLE command. Then execute the following query
MySQL Syntax (Toggle Plain Text)
  1. UPDATE files SET
  2. fullthumb = CONCAT('http://k5live.com/thumbs/', thumb);

will this code be ran all the time to always update
Reputation Points: 13
Solved Threads: 0
Junior Poster in Training
welbyobeng is offline Offline
75 posts
since Oct 2006
Mar 10th, 2008
0

Re: IS it possible

Or you can create a trigger to UPDATE this for you when a new record is inserted.
Reputation Points: 29
Solved Threads: 47
Posting Whiz
mwasif is offline Offline
312 posts
since Dec 2007
Mar 10th, 2008
0

Re: IS it possible

Click to Expand / Collapse  Quote originally posted by mwasif ...
Or you can create a trigger to UPDATE this for you when a new record is inserted.
nice...so how would i create a trigger to by default store "'http://k5live.com/thumbs/" and add thumb to it.
Reputation Points: 13
Solved Threads: 0
Junior Poster in Training
welbyobeng is offline Offline
75 posts
since Oct 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in MySQL Forum Timeline: error in connecting MySql and PHPBB help me.....
Next Thread in MySQL Forum Timeline: I am not a developer





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC