我正在尝试从 1 列复制到另一列,基本上是获取列名称并将其放在列描述中,但保持在描述之上,到目前为止一切正常,我只是不知道如何将成品放入h2 e.g
name = Best banana
description = The most yellow thing ever
end result
name = Best banana
description = <h2>Best banana</h2> The most yellow thing ever
到目前为止,这是我的代码
$sql = "UPDATE product_description SET description = if(description is NULL, name, concat(name, description));";
我试过这个:
$sql = "UPDATE product_description SET description = if(description is NULL, name, concat('<h2>name</h2>', description));";
但是这个'<h2>name</h2>'
在 h2 中显示单词名称,而不是在表格中显示有关如何执行此操作的任何提示?
最佳答案
尝试
$sql = "UPDATE product_description SET description = if(description is NULL, name, concat('<h2>', name, '</h2>', description));";
关于php - MySQL Php 将 <h2> 添加到数据库中的文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30254884/