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

More
11 years 7 months ago #35245 by tonnick
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

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

More
11 years 7 months ago #35261 by micker
cool think to edit you post to add solved icone thanks

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 #35272 by ggppdk
Your SQL query replacing the value needs to be more specific so that it replaces only the desirable text parts but leaves other part intact,

Also note that data are PHP serialized if you replace text of 5 characters with text of 6 characters then the serialized data may get broken


-- 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 #35278 by tonnick
I don't know in which way mysql request has to be more specific ? maybe could you light me here ?

and you mean that I cannot replace text displayed by image for exemple, as number of characters will be differents ?! this si why link get broken ?!

so you mean there is no solution for my question here ?

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

More
11 years 7 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...

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

More
11 years 7 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.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.427 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