Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/290.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何将一列的内容复制到另一列?_Php_Html_Mysql_Sql - Fatal编程技术网

Php 如何将一列的内容复制到另一列?

Php 如何将一列的内容复制到另一列?,php,html,mysql,sql,Php,Html,Mysql,Sql,我有以下表格结构: // Posts +----+---------+-----------------+------------------+------------------------+------------------------+ | id | title | content_html | content_markdown | content_edit_html | content_edit_markdown | +----+---------+-------

我有以下表格结构:

// Posts
+----+---------+-----------------+------------------+------------------------+------------------------+
| id |  title  |  content_html   | content_markdown |   content_edit_html    | content_edit_markdown  |
+----+---------+-----------------+------------------+------------------------+------------------------+
| 1  | title1  | <b>content1</b> | **content1**     | <b>content1_edited</b> | **content1_edited**    |
| 2  | title2  | <i>content2</i> | *content2*       |                        |                        |
+----+---------+-----------------+------------------+------------------------+------------------------+
我还使用一个PHP库将其转换为html,并进行如下操作:

<b>content1_new_value</b>
<i>content2_new_value</i>

示例二:我想编辑尚未编辑的第二篇文章。以下是新的价值观:

**content1_new_value**
*content2_new_value*
我还使用一个PHP库将其转换为html,并进行如下操作:

<b>content1_new_value</b>
<i>content2_new_value</i>

如你所见,我只保留最后两次编辑。我怎样才能做到这一点?

在其他操作结束时检查案例

case  
when content_edit_html is not null
update table set content_html = content_edit_html, content_markdown = content_edit_markdown, 
content_edit_html = <b>content1_new_value</b>, content_edit_markdown = **content_new_value**
where id = 1
else
update table set content_edit_html = <b>content1_new_value</b>, content_edit_markdown = **content_new_value**
where id = 1
end
案例
当内容\u编辑\u html不为空时
更新表集内容\u html=content\u edit\u html,content\u markdown=content\u edit\u markdown,
content\u edit\u html=content1\u new\u value,content\u edit\u markdown=**content\u new\u value**
其中id=1
其他的
更新表集内容\u编辑\u html=content1\u新值,内容\u编辑\u标记=**内容\u新值**
其中id=1
结束

在ELSE结束时检查大小写

case  
when content_edit_html is not null
update table set content_html = content_edit_html, content_markdown = content_edit_markdown, 
content_edit_html = <b>content1_new_value</b>, content_edit_markdown = **content_new_value**
where id = 1
else
update table set content_edit_html = <b>content1_new_value</b>, content_edit_markdown = **content_new_value**
where id = 1
end
案例
当内容\u编辑\u html不为空时
更新表集内容\u html=content\u edit\u html,content\u markdown=content\u edit\u markdown,
content\u edit\u html=content1\u new\u value,content\u edit\u markdown=**content\u new\u value**
其中id=1
其他的
更新表集内容\u编辑\u html=content1\u新值,内容\u编辑\u标记=**内容\u新值**
其中id=1
结束

@stack如果答案解决了您的问题,您也应该将其标记为正确。@stack如果答案解决了您的问题,您也应该将其标记为正确。