简体   繁体   English

将MySQL插入内容从逗号分隔为管道

[英]Convert MySQL insert from comma separated to piping

I have a problem to insert detail from one table into another in MySQL table. 我在将详细信息从一个表插入到MySQL表中的另一个表时遇到问题。 The compatibility differs as the one table accepts commas to separate detail in a column and the other table accepts piping. 兼容性不同,因为一个表接受逗号分隔列中的详细信息,而另一表接受管道。 What PHP code can I use to convert the commas into piping? 我可以使用什么PHP代码将逗号转换为管道?

Ok guys let me re-phrase. 好的,让我重新措辞。 I am doing a data dump from another db to my db, the problem is that the content formats of the two tables aren't compatible, meaning that my one table uses UPPERCASE and the other one uses camelCase, and that the one uses (,) without spaces behind or infront where the other table uses (|) with spaces on both sides. 我正在将数据从另一个数据库转储到我的数据库,问题是两个表的内容格式不兼容,这意味着我的一个表使用UPPERCASE,而另一个表使用camelCase,而一个表使用(, )后面或前面没有空格,而另一张桌子使用(|)在两边都有空格。 I'm lost and need help 我迷路了,需要帮助

我找到了答案:$ replace = str_replace(“,”,“ |”,$ result2);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM