我想用钩子来改进离子立方厘米。
我需要一个SQL查询能够在表中的特定行中空白mysql内容,但只有当所讨论的内容以"修改的产品/服务-用户名从"开始
澄清一下:
- 相关cms在修改产品密码时记录新/旧用户密码日志。我想创建一个钩子,它将检测添加到日志中的行,然后删除它. ...或者更好:一种方法来要求mysql拒绝保存一些以"Modified Product/Service…"开头的东西。(我认为这将不得不在php中完成,但也,我无法弄清楚如何做到这一点)
我需要的SQL请求是什么?
谢谢你的帮助:)
DELETE FROM yourTable
WHERE content LIKE 'Modified Product/Service - Username changed from to %'
这个句子真的这样说from to
吗?更有可能是from OLDNAME to NEWNAME
。如果是,那部分模式应该是from % to %
。
在PHP中,您可以使用以下命令来防止插入行:
if (!preg_match('#^Modified Product/Service - Username changed from to#', $content)) {
// Code here to insert the row
}
如果你想在PHP中限制你可以使用
<?php
$question = $_POST['question'];
if (strpos($question,'Modified Product/Service - Username changed from to') !== false){
//redirect to some page or exit the control
}else{
//execute the insert Query here
}
?>