ukscotth Posted November 19, 2009 Share Posted November 19, 2009 Hi, I have a database table which is full of paths to pictures e.g /pictures/12313213.jpg /pictures/35423454.jpg Id like to change all the data to a longer path, basically i need to add some text to the beginning of every entry so the table contains things like this instead : http://www.blahblah.com/pictures/12313213.jpg http://www.blahblah.com/pictures/35423454.jpg Can someone show me how plzzzzz ? thanks very much. Scott Quote Link to comment https://forums.phpfreaks.com/topic/182185-solved-adding-text-to-contents-of-a-database-table/ Share on other sites More sharing options...
premiso Posted November 19, 2009 Share Posted November 19, 2009 As long as the first path is the same a simple update in phpMyAdmin will work using this SQL: UPDATE table_name SET column_name = CONCAT('http://www.blahblah.com', column_name) That should work, I have never done it so I could be wrong... I would do a test on one table element first by adding a WHERE clause to that so you do not screw up your whole table (or backup for table). Quote Link to comment https://forums.phpfreaks.com/topic/182185-solved-adding-text-to-contents-of-a-database-table/#findComment-961289 Share on other sites More sharing options...
ukscotth Posted November 19, 2009 Author Share Posted November 19, 2009 Thanks for a fast response premiso il give it a try now Quote Link to comment https://forums.phpfreaks.com/topic/182185-solved-adding-text-to-contents-of-a-database-table/#findComment-961291 Share on other sites More sharing options...
ukscotth Posted November 19, 2009 Author Share Posted November 19, 2009 Works perfect. Thanks again for your help Quote Link to comment https://forums.phpfreaks.com/topic/182185-solved-adding-text-to-contents-of-a-database-table/#findComment-961297 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.