[resolved] How to massive change field values via SQL query

More
11 years 8 months ago - 11 years 6 months ago #34867 by tonnick
Hello

par default, j'ai des champs de type lien externe de ce genre :
monlien.com :: link

je voudrais remplacer le mot link soit par le symbole @ soit par un autre texte.

j'ai tenté la requête suivante :

UPDATE `mabase`.`jos_flexicontent_fields_item_relations` SET `value` = replace(`value`, 'info', 'link')

ca a l'air de marcher mais malheureusement le lien ne marche plus.

et dès que je veux remplacer par un symbole ou image du type :
UPDATE `mabase`.`jos_flexicontent_fields_item_relations` SET `value` = replace(`value`, 'info', '<img src="/images/ico/info.png">')

ou
UPDATE `mabase`.`jos_flexicontent_fields_item_relations` SET `value` = replace(`value`, 'info', '@')

au lieu d'avoir du texte, c'est la valeur du lien qui s'affiche.

est ce qu'il y aurait moyen de faire ce genre de manipulation ?
Last edit: 11 years 6 months ago by tonnick.

Please Log in or Create an account to join the conversation.

More
11 years 8 months ago #34869 by ggppdk
Hello,

i am not sure what you are asking (by reading translation)

but i understand that this is a general MySQL question, for this i would myself read MySQL or SQL server docs,

Just take care not to corrupt data any data of the table, (i guess you have backuped the table right?)

Regards


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

More
11 years 7 months ago #34889 by micker
si c'est en affichage
utilise le composant reremplacer et créer une regle qui remplace ce qui est afficher sur le site directement
si j'ai bien compris l'idée

FLEXIcontent is Free but involves a very big effort on our part.
Like the our support? (for a bug-free FC, despite being huge extension) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing reviews. Thanks![/size]

Please Log in or Create an account to join the conversation.

More
11 years 7 months ago #34908 by tonnick
>> ggppdk
of course, I do database backup and I work always first on my local server before passing it into the web.

I use this great import function to import articles with some custom field external links. as said, format is :
link::mylink.com

so in frontend appears in the column "external link" the word "link" with the external link.

but my fantastic customer changed his mind and would like to replace the word "link" or by a "@" or by an image.

this is why I tried the mysql request provided. so it work more or less, but not totally :/. I guess that I miss something, but I don't know what.

>> micker
yes I thought it would be a solution to write in php some function which would replace the word "link" by something else, but I think (maybe wrongly) that it's not the "clearest" solution. but if I have no chance using mysql option, it would be the second one to investigate.

Please Log in or Create an account to join the conversation.

More
11 years 7 months ago #34924 by ggppdk
the string
link:

may appear in other cases too , so the proper whay would be to limit it to a specific field id


e.g. add
WHERE field_id=45

like this:

UPDATE `mabase`.`jos_flexicontent_fields_item_relations` SET `value` = replace(`value`, 'info', '@') WHERE field_id=45


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

More
11 years 7 months ago #34926 by tonnick
well if I do that :

UPDATE `mybase`.`jos_flexicontent_fields_item_relations` SET `value` = replace(`value`, 'link', '@') WHERE field_id=45;

it displays all the value in my column :/


and if I do

UPDATE `mybase`.`jos_flexicontent_fields_item_relations` SET `value` = replace(`value`, 'link', 'test') WHERE field_id=45;

text "test" is well displayed but link is broken

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.426 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline