I am trying to replace a text in a Prestashop database by selecting 2 columns so that the first column will be id_lang
that contains value 1.
我试图通过选择2列来替换Prestashop数据库中的文本,以便第一列将是包含值1的id_lang。
I don't really know how to explain it batter so I have made the screenshot below of what i am trying to do. id_lang
contains all the languages for my website so 1= English.
我真的不知道如何解释它,所以我在下面做了我想要做的截图。 id_lang包含我网站的所有语言,因此1 =英语。
What I want is to select just the column that contains 1 (English) and replace some text in the description_short
.
我想要的是只选择包含1(英语)的列并替换description_short中的一些文本。
Is there any way to do this? I was trying some methods that I found on SO but none of them are working.
有没有办法做到这一点?我正在尝试一些我在SO上找到的方法,但它们都没有工作。
2 个解决方案
#1
0
You can simply update the columns using
您只需使用更新列即可
UPDATE ps_product_lang SET description_short = 'new value' WHERE id_lang = 1
更新ps_product_lang SET description_short ='新值'WHERE id_lang = 1
For certain replacements of existing values, you can use the REPLACE
function of MySQL, too. https://dev.mysql.com/doc/refman/5.7/en/string-functions.html#function_replace
对于现有值的某些替换,您也可以使用MySQL的REPLACE函数。 https://dev.mysql.com/doc/refman/5.7/en/string-functions.html#function_replace
#2
0
I am not sure what you want to Replace in your Tables. Here are 2 simple examples incase you might need them.
我不确定你要在表格中替换什么。这里有两个简单的例子,你可能需要它们。
Update Single Column in Table:
更新表中的单个列:
UPDATE ps_product_lang
SET
description_short = 'NEW SHORT DESCRIPTION',
WHERE
id_lang = 1;
Update Multiple Columns in Table:
更新表中的多个列:
UPDATE ps_product_lang
SET
description = 'NEW DESCRIPTION',
description_short = 'NEW SHORT DESCRIPTION'
WHERE
id_lang = 1;
A bit more info could be much helpfull about what you want to replace and with what. Good luck
更多信息可能对您想要替换的内容和内容有所帮助。祝你好运
#1
0
You can simply update the columns using
您只需使用更新列即可
UPDATE ps_product_lang SET description_short = 'new value' WHERE id_lang = 1
更新ps_product_lang SET description_short ='新值'WHERE id_lang = 1
For certain replacements of existing values, you can use the REPLACE
function of MySQL, too. https://dev.mysql.com/doc/refman/5.7/en/string-functions.html#function_replace
对于现有值的某些替换,您也可以使用MySQL的REPLACE函数。 https://dev.mysql.com/doc/refman/5.7/en/string-functions.html#function_replace
#2
0
I am not sure what you want to Replace in your Tables. Here are 2 simple examples incase you might need them.
我不确定你要在表格中替换什么。这里有两个简单的例子,你可能需要它们。
Update Single Column in Table:
更新表中的单个列:
UPDATE ps_product_lang
SET
description_short = 'NEW SHORT DESCRIPTION',
WHERE
id_lang = 1;
Update Multiple Columns in Table:
更新表中的多个列:
UPDATE ps_product_lang
SET
description = 'NEW DESCRIPTION',
description_short = 'NEW SHORT DESCRIPTION'
WHERE
id_lang = 1;
A bit more info could be much helpfull about what you want to replace and with what. Good luck
更多信息可能对您想要替换的内容和内容有所帮助。祝你好运