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

More
12 years 10 months ago #35281 by ggppdk

tonnick wrote: and I tried your solution, micker :

<?php if (isset($item->positions)) : ?>
<?php foreach ($item->positions as $field) : ?>
<?php echo str_replace("link","toto",$field->display ? $field->display : ''); ?>
<?php endforeach; ?>
<?php endif; ?>

but result is that link is getting broken as new text "toto" is not original one in system --+ does not work neither


hello,
please note that your question is a kind of General PHP and general SQL question,

nevertheless the above should work,
why you say that the above is not working?
e.g. what is the above producing ? an result example of it



Why do you say that thus does not work? what is the result
also maybe try this:
Code:
<?php echo str_replace("link::","@::",$field->display ? $field->display : ''); ?>


-- 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 review. Thanks!

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

More
12 years 10 months ago #35303 by tonnick
ok here are results :

/*** PHP ***/

<?php echo str_replace("link","@",$field->display ? $field->display : ''); ?>

>>> it display right text, but link get as following :

http://mydomain/index.php/fr/ig-i-r%C3%A9pertoire-mondial-des-ig-d%E2%80%99origin/web@/15/1300/1

So, I guess because of web@ it does not work anymore.


your solution :

<?php echo str_replace("link::","@::",$field->display ? $field->display : ''); ?>

nothing at all. >> no change



/*** Mysql ***/

1st request :

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

instead of @ displayed, I have :

a:3:{s:4:"@";s:82:"ec.europa.eu/agriculture/quality/door/registeredName.html?denominationId=50";s:5:"title";s:4:"@";s:4:"hits";i:12;}

>> not good at all.


2nd request :

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

text is well displayed (test instead of link) links seems to be ok :

index.php/fr/ig-i-r%C3%A9pertoire-mondial-des-ig-d%E2%80%99origin/weblink/15/1300/1

but it stay stuck on it... as if it wouldn't be anymore link behind it....

not good either :/

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

More
12 years 9 months ago #36431 by tonnick
ok at the end I used this hack :

www.flexicontent.org/forum/index ... =viewtopic

which works and not break anything ;)

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

Moderators: vistamediajoomlacornerggppdk
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
Save