spottedhaggis Posted December 4, 2006 Share Posted December 4, 2006 Hi,Newbie here.I needa little help, hope you can help me. I have a database and need to add a path to a field. The field data already contains an image filename - 123_1234.jpg.This is all about Zencart. My host has a 2k limit on files in a specific folder, however my client havs 2700 images (products) so the only way I can see around this is to alter the image paths for each category as follows.Currently all images are in the image folder, and in the DB its simply field - images - data = image filename.What I want to do is run a query that only updates all image fild content for a specific category ID number (there are 15 categories) so in summaryUpdate the content of the image field where all category IDs are equal to a specified number (1) and add cat1/ to the front of the data already inside the image field.Can this be done at all.So where the images field data was as follows : 123-1234.jpgI need it to be cat1/123-1234.jpg for all images designated to category 1, and cat2 etc etcWhew, thanks in advance for any help on this. Link to comment https://forums.phpfreaks.com/topic/29458-adding-data-to-field-with-data-in/ Share on other sites More sharing options...
artacus Posted December 5, 2006 Share Posted December 5, 2006 Well do a select first that joins image and category then after you have that working...[code]UPDATE images AS imgJOIN category AS cat ON ...SET img.filename = CONCAT('cat', cat.id, '/', img.filename)[/code] Link to comment https://forums.phpfreaks.com/topic/29458-adding-data-to-field-with-data-in/#findComment-135698 Share on other sites More sharing options...
fenway Posted December 6, 2006 Share Posted December 6, 2006 artacus is correct... but I question why you want to hard-code this... Link to comment https://forums.phpfreaks.com/topic/29458-adding-data-to-field-with-data-in/#findComment-135962 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.